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

Yoast / wordpress-seo / 5fcd9d656386031621699b1f82962fab1422ffe8

13 Nov 2025 12:39PM UTC coverage: 49.21%. First build
5fcd9d656386031621699b1f82962fab1422ffe8

Pull #22710

github

web-flow
Merge ec39a8ba8 into fb6635efc
Pull Request #22710: Allow for Premium to register its own tasks via filter

0 of 1 new or added line in 1 file covered. (0.0%)

17497 of 35556 relevant lines covered (49.21%)

3.88 hits per line

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

0.0
/src/task-list/application/tasks-collector.php
1
<?php
2

3
namespace Yoast\WP\SEO\Task_List\Application;
4

5
use Yoast\WP\SEO\Task_List\Domain\Tasks\Completeable_Task_Interface;
6
use Yoast\WP\SEO\Task_List\Domain\Tasks\Task_Interface;
7

8
/**
9
 * Manages the collection of tasks.
10
 */
11
class Tasks_Collector {
12

13
        /**
14
         * Holds all the tasks.
15
         *
16
         * @var Task_Interface[]
17
         */
18
        private $tasks;
19

20
        /**
21
         * Constructs the collector.
22
         *
23
         * @param Task_Interface ...$tasks All the tasks.
24
         */
25
        public function __construct( Task_Interface ...$tasks ) {
×
26
                $tasks_with_id = [];
×
27
                foreach ( $tasks as $task ) {
×
28
                        $tasks_with_id[ $task->get_id() ] = $task;
×
29
                }
30

31
                $this->tasks = $tasks_with_id;
×
32
        }
33

34
        /**
35
         * Gets a task.
36
         *
37
         * @param string $task_id The task ID.
38
         *
39
         * @return Task_Interface The given task.
40
         */
41
        public function get_task( string $task_id ): ?Task_Interface {
×
42
                $all_tasks = $this->get_tasks();
×
43
                return ( $all_tasks[ $task_id ] ?? null );
×
44
        }
45

46
        /**
47
         * Gets a completeable task.
48
         *
49
         * @param string $task_id The task ID.
50
         *
51
         * @return Task_Interface The given task.
52
         */
53
        public function get_completeable_task( string $task_id ): ?Completeable_Task_Interface {
×
54
                $all_tasks = $this->get_tasks();
×
55
                $task      = ( $all_tasks[ $task_id ] ?? null );
×
56

57
                if ( ! $task instanceof Completeable_Task_Interface ) {
×
58
                        return null;
×
59
                }
60

61
                return $task;
×
62
        }
63

64
        /**
65
         * Gets the tasks.
66
         *
67
         * @return array<string, array<string, Task_Interface>> The tasks.
68
         */
69
        public function get_tasks(): array {
×
70
                /**
71
                 * Filter: 'wpseo_task_list_tasks' - Allows adding more tasks to the task list.
72
                 *
73
                 * @param array<string, array<string, Task_Interface>> $tasks The tasks for the task list.
74
                 */
NEW
75
                return \apply_filters( 'wpseo_task_list_tasks', $this->tasks );
×
76
        }
77
}
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