Yoast\WP\SEO\Schema_Aggregator\Application

Schema_Aggregator_Response_Composer{}Yoast 1.0

Class Schema_Aggregator_Response_Composer

Composes the final schema response.

Хуков нет.

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

$Schema_Aggregator_Response_Composer = new Schema_Aggregator_Response_Composer();
// use class methods

Методы

  1. public compose( Schema_Piece_Collection $schema_pieces )

Код Schema_Aggregator_Response_Composer{} Yoast 27.8

class Schema_Aggregator_Response_Composer {

	/**
	 * Composes the final schema response.
	 *
	 * @param Schema_Piece_Collection $schema_pieces The schema pieces to include in the response.
	 *
	 * @return array<string> The composed schema response.
	 */
	public function compose( Schema_Piece_Collection $schema_pieces ): array {
		$composed_pieces = [];
		foreach ( $schema_pieces->to_array() as $piece ) {
			$composed_pieces[] = \array_merge(
				[
					'@context' => 'https://schema.org',
				],
				$piece->get_data(),
			);
		}
		return $composed_pieces;
	}
}