Automattic\WooCommerce\Api\Utils

SchemaHandle::read_type_metadataprivate staticWC 1.0

Read type-level metadata from a wrapped engine type.

The wrapper subclasses in Internal/Api/Schema/ expose get_metadata(); non-wrapper types (e.g. the built-in scalars, the introspection types we already filtered out) don't carry metadata and contribute an empty array.

Method of the class: SchemaHandle{}

No Hooks.

Returns

Array. bool|int|float|string|null>

Usage

$result = SchemaHandle::read_type_metadata( $type ): array;
$type(Type) (required)
The GraphQL type to inspect.

SchemaHandle::read_type_metadata() code WC 10.9.1

private static function read_type_metadata( Type $type ): array {
	if ( method_exists( $type, 'get_metadata' ) ) {
		$metadata = $type->get_metadata();
		return is_array( $metadata ) ? $metadata : array();
	}
	return array();
}