Automattic\WooCommerce\RestApi

Server::get_v4_controllerprotectedWC 1.0

Get instance of a V4 controller.

Method of the class: Server{}

No Hooks.

Returns

Object. The instance of the controller.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_v4_controller( $identifier, $route );
$identifier(string) (required)
Controller identifier.
$route(string) (required)
Route class name.

Server::get_v4_controller() code WC 10.3.6

protected function get_v4_controller( $identifier, $route ) {
	if ( isset( $this->controllers['wc/v4'][ $identifier ] ) ) {
		return $this->controllers['wc/v4'][ $identifier ];
	}
	return new $route();
}