Automattic\WooCommerce\StoreApi\Schemas

ExtendSchema::get_endpoint_schema()publicWC 1.0

Returns the registered endpoint schema

{} Это метод класса: ExtendSchema{}

Хуков нет.

Возвращает

Объект. Returns an array with registered schema data.

Использование

$ExtendSchema = new ExtendSchema();
$ExtendSchema->get_endpoint_schema( $endpoint, $passed_args );
$endpoint(строка) (обязательный)
A valid identifier.
$passed_args(массив)
Passed arguments from the Schema class.
По умолчанию: []

Код ExtendSchema::get_endpoint_schema() WC 6.8.0

public function get_endpoint_schema( $endpoint, array $passed_args = [] ) {
	$registered_schema = [];

	if ( isset( $this->extend_data[ $endpoint ] ) ) {
		foreach ( $this->extend_data[ $endpoint ] as $namespace => $callbacks ) {
			if ( is_null( $callbacks['schema_callback'] ) ) {
				continue;
			}
			try {
				$schema = $callbacks['schema_callback']( ...$passed_args );

				if ( ! is_array( $schema ) ) {
					$schema = [];
					throw new \Exception( '$schema_callback must return an array.' );
				}
			} catch ( \Throwable $e ) {
				$this->throw_exception( $e );
			}

			$registered_schema[ $namespace ] = $this->format_extensions_properties( $namespace, $schema, $callbacks['schema_type'] );
		}
	}

	return (object) $registered_schema;
}