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

Yoast / wordpress-seo / 6327313ccd03eed226357a74a59d784d688c244f

12 Feb 2026 10:51AM UTC coverage: 53.048% (-0.5%) from 53.589%
6327313ccd03eed226357a74a59d784d688c244f

Pull #22966

github

web-flow
Merge 0afdd2613 into 70b457eae
Pull Request #22966: Complete @TODOs

8467 of 15964 branches covered (53.04%)

Branch coverage included in aggregate %.

2 of 4 new or added lines in 2 files covered. (50.0%)

21 existing lines in 3 files now uncovered.

32741 of 61717 relevant lines covered (53.05%)

46722.78 hits per line

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

0.0
/src/task-list/domain/components/score-task-analyzer.php
1
<?php
2

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

6
use InvalidArgumentException;
7

8
/**
9
 * Represents a score-based analyzer component for a task.
10
 */
11
class Score_Task_Analyzer implements Task_Analyzer_Interface {
12

13
        /**
14
         * Allowed results.
15
         *
16
         * @var string[]
17
         */
18
        private const ALLOWED_RESULTS = [
19
                'good',
20
                'ok',
21
                'bad',
22
        ];
23

24
        /**
25
         * The title of the analyzer (e.g. "SEO analysis").
26
         *
27
         * @var string
28
         */
29
        private $title;
30

31
        /**
32
         * The result of the analyzer.
33
         *
34
         * @var string
35
         */
36
        private $result;
37

38
        /**
39
         * The human-readable label for the result (e.g. "Needs improvement").
40
         *
41
         * @var string
42
         */
43
        private $result_label;
44

45
        /**
46
         * The description text explaining the result.
47
         *
48
         * @var string
49
         */
50
        private $result_description;
51

52
        /**
53
         * The constructor.
54
         *
55
         * @param string $title              The title of the analyzer.
56
         * @param string $result             The result.
57
         * @param string $result_label       The human-readable label for the result.
58
         * @param string $result_description The description text explaining the result.
59
         *
60
         * @throws InvalidArgumentException If the result is invalid.
61
         */
UNCOV
62
        public function __construct(
×
63
                string $title,
64
                string $result,
65
                string $result_label,
66
                string $result_description
67
        ) {
UNCOV
68
                if ( ! \in_array( $result, self::ALLOWED_RESULTS, true ) ) {
×
UNCOV
69
                        throw new InvalidArgumentException( 'Invalid result for score task analyzer' );
×
70
                }
71

UNCOV
72
                $this->title              = $title;
×
UNCOV
73
                $this->result             = $result;
×
UNCOV
74
                $this->result_label       = $result_label;
×
UNCOV
75
                $this->result_description = $result_description;
×
76
        }
77

78
        /**
79
         * Returns the type of the analyzer.
80
         *
81
         * @return string
82
         */
UNCOV
83
        public function get_type(): string {
×
UNCOV
84
                return 'score';
×
85
        }
86

87
        /**
88
         * Returns an array representation of the analyzer data.
89
         *
90
         * @TODO: Add an abstract task analyzer class and move this logic there.
91
         *
92
         * @return array<string, string> Returns in an array format.
93
         */
UNCOV
94
        public function to_array(): array {
×
UNCOV
95
                return [
×
UNCOV
96
                        'type'              => $this->get_type(),
×
UNCOV
97
                        'title'             => $this->title,
×
UNCOV
98
                        'result'            => $this->result,
×
UNCOV
99
                        'resultLabel'       => $this->result_label,
×
UNCOV
100
                        'resultDescription' => $this->result_description,
×
UNCOV
101
                ];
×
102
        }
103
}
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