# wordpress-seo/28.0/src/schema-aggregator/application/schema-aggregator-response-composer.php

Yoast SEO – Advanced SEO with real-time guidance and built-in AI, version 28.0. 34 lines.

- Page: https://pluginprobe.com/plugins/wordpress-seo/28.0/code/src/schema-aggregator/application/schema-aggregator-response-composer.php
- Raw: https://pluginprobe.com/plugins/wordpress-seo/28.0/raw/src/schema-aggregator/application/schema-aggregator-response-composer.php
- Modified: 2026-02-24T09:39:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wordpress-seo/28.0/code/src/schema-aggregator/application/schema-aggregator-response-composer.php#L10-L20`.

```php
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\Schema_Aggregator\Application;

use Yoast\WP\SEO\Schema_Aggregator\Domain\Schema_Piece_Collection;

/**
 * Class Schema_Aggregator_Response_Composer
 *
 * Composes the final schema response.
 */
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;
	}
}

```
