Automattic\WooCommerce\Blocks\Domain\Services
ExtendRestApi::get_endpoint_schema() public WC 1.0
Returns the registered endpoint schema
{} Это метод класса: ExtendRestApi{}
Хуков нет.
Возвращает
Массив. Returns an array with registered schema data.
Использование
$ExtendRestApi = new ExtendRestApi(); $ExtendRestApi->get_endpoint_schema( $endpoint, $passed_args );
- $endpoint(строка) (обязательный)
- A valid identifier.
- $passed_args(массив)
- Passed arguments from the Schema class.
Код ExtendRestApi::get_endpoint_schema() ExtendRestApi::get endpoint schema WC 5.0.0
public function get_endpoint_schema( $endpoint, array $passed_args = [] ) {
$registered_schema = [];
if ( ! isset( $this->extend_data[ $endpoint ] ) ) {
return (object) $registered_schema;
}
foreach ( $this->extend_data[ $endpoint ] as $namespace => $callbacks ) {
$schema = [];
try {
$schema = $callbacks['schema_callback']( ...$passed_args );
if ( ! is_array( $schema ) ) {
throw new Exception( '$schema_callback must return an array.' );
}
} catch ( Throwable $e ) {
$this->throw_exception( $e );
continue;
}
$schema = $this->format_extensions_properties( $namespace, $schema );
$registered_schema[ $namespace ] = $schema;
}
return (object) $registered_schema;
}