Automattic\WooCommerce\RestApi

Server::register_rest_routes()publicWC 1.0

Register REST API routes.

Method of the class: Server{}

No Hooks.

Return

null. Nothing (null).

Usage

$Server = new Server();
$Server->register_rest_routes();

Server::register_rest_routes() code WC 9.0.1

public function register_rest_routes() {
	$container    = wc_get_container();
	$legacy_proxy = $container->get( LegacyProxy::class );
	foreach ( $this->get_rest_namespaces() as $namespace => $controllers ) {
		foreach ( $controllers as $controller_name => $controller_class ) {
			$this->controllers[ $namespace ][ $controller_name ] =
				$container->has( $controller_class ) ?
				$container->get( $controller_class ) :
				$legacy_proxy->get_instance_of( $controller_class );
			$this->controllers[ $namespace ][ $controller_name ]->register_routes();
		}
	}
}