PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.2
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / schema-aggregator / application / schema-aggregator-response-composer.php

schema-aggregator-response-composer.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.2, at src/schema-aggregator/application/schema-aggregator-response-composer.php

34 lines 889 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3 namespace Yoast\WP\SEO\Schema_Aggregator\Application;
4
5 use Yoast\WP\SEO\Schema_Aggregator\Domain\Schema_Piece_Collection;
6
7 /**
8 * Class Schema_Aggregator_Response_Composer
9 *
10 * Composes the final schema response.
11 */
12 class Schema_Aggregator_Response_Composer {
13
14 /**
15 * Composes the final schema response.
16 *
17 * @param Schema_Piece_Collection $schema_pieces The schema pieces to include in the response.
18 *
19 * @return array<string> The composed schema response.
20 */
21 public function compose( Schema_Piece_Collection $schema_pieces ): array {
22 $composed_pieces = [];
23 foreach ( $schema_pieces->to_array() as $piece ) {
24 $composed_pieces[] = \array_merge(
25 [
26 '@context' => 'https://schema.org',
27 ],
28 $piece->get_data(),
29 );
30 }
31 return $composed_pieces;
32 }
33 }
34