Automattic\WooCommerce\StoreApi\Schemas\V1

AbstractSchema::get_item_responses_from_schema()protectedWC 1.0

Apply a schema get_item_response callback to an array of items and return the result.

Method of the class: AbstractSchema{}

No Hooks.

Return

Array. Array of values from the callback function.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_item_responses_from_schema( $schema, $items );
$schema(AbstractSchema) (required)
Schema class instance.
$items(array) (required)
Array of items.

AbstractSchema::get_item_responses_from_schema() code WC 9.3.3

protected function get_item_responses_from_schema( AbstractSchema $schema, $items ) {
	$items = array_filter( $items );

	if ( empty( $items ) ) {
		return [];
	}

	return array_values( array_map( [ $schema, 'get_item_response' ], $items ) );
}