• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 9b2013021487f6b99d14a2efe5445abc0f6cbd98

28 Oct 2025 03:28PM UTC coverage: 52.61% (-0.08%) from 52.692%
9b2013021487f6b99d14a2efe5445abc0f6cbd98

Pull #22678

github

web-flow
Merge bbae0efb3 into 16bdf72ad
Pull Request #22678: Introduce aggregator

8147 of 15270 branches covered (53.35%)

Branch coverage included in aggregate %.

0 of 140 new or added lines in 8 files covered. (0.0%)

99 existing lines in 4 files now uncovered.

31468 of 60030 relevant lines covered (52.42%)

39782.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/schema-aggregator/application/aggregate-site-schema-command-handler.php
1
<?php
2

3
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
4
namespace Yoast\WP\SEO\Schema_Aggregator\Application;
5

6
use Yoast\WP\SEO\Schema_Aggregator\Infrastructure\Schema_Piece_Repository;
7

8
/**
9
 * Class that handles the Aggregate_Site_Schema_Command.
10
 */
11
class Aggregate_Site_Schema_Command_Handler {
12

13
        /**
14
         * The Schema_Piece_Repository instance.
15
         *
16
         * @var Schema_Piece_Repository
17
         */
18
        private $schema_piece_repository;
19

20
        /**
21
         * The Schema_Pieces_Aggregator instance.
22
         *
23
         * @var Schema_Pieces_Aggregator
24
         */
25
        private $schema_piece_aggregator;
26

27
        /**
28
         * Aggregate_Site_Schema_Command_Handler constructor.
29
         *
30
         * @param Schema_Piece_Repository  $schema_piece_repository The collector of indexables that need to be aggregated.
31
         * @param Schema_Pieces_Aggregator $schema_piece_aggregator The schema pieces aggregator.
32
         */
NEW
33
        public function __construct( Schema_Piece_Repository $schema_piece_repository, Schema_Pieces_Aggregator $schema_piece_aggregator ) {
×
34
                $this->schema_piece_repository = $schema_piece_repository;
×
NEW
35
                $this->schema_piece_aggregator = $schema_piece_aggregator;
×
36
        }
37

38
        /**
39
         * Handles the Aggregate_Site_Schema_Command.
40
         *
41
         * @param Aggregate_Site_Schema_Command $command The command.
42
         *
43
         * @return array<string> The aggregated schema.
44
         */
45
        public function handle( Aggregate_Site_Schema_Command $command ): array {
×
46

47
                $schema_pieces = $this->schema_piece_repository->get(
×
48
                        $command->get_page_controls()->get_page(),
×
49
                        $command->get_page_controls()->get_page_size()
×
50
                );
×
51

NEW
52
                $aggregated_schema_pieces = $this->schema_piece_aggregator->aggregate( $schema_pieces );
×
NEW
53
                $schema                   = [];
×
NEW
54
                foreach ( $aggregated_schema_pieces as $schema_piece ) {
×
NEW
55
                        $schema[] = $schema_piece->to_json_ld_graph();
×
56
                }
57
                return $schema;
×
58
        }
59
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc