Automattic\WooCommerce\StoreApi
SchemaController::get
Get a schema class instance.
Method of the class: SchemaController{}
No Hooks.
Returns
Schemas\V1\AbstractSchema. A new instance of the requested schema.
Usage
$SchemaController = new SchemaController(); $SchemaController->get( $name, $version );
- $name(string) (required)
- Name of schema.
- $version(int)
- API Version being requested.
Default:1
SchemaController::get() SchemaController::get code WC 10.6.2
public function get( $name, $version = 1 ) {
$schema = $this->schemas[ "v{$version}" ][ $name ] ?? false;
if ( ! $schema ) {
throw new \Exception( "{$name} v{$version} schema does not exist" );
}
return new $schema( $this->extend, $this );
}