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

Yoast / wordpress-seo / ad6e72171e3eefd7cb3e2103162790a219c90b8c

17 Nov 2025 10:49AM UTC coverage: 49.108%. First build
ad6e72171e3eefd7cb3e2103162790a219c90b8c

Pull #22718

github

web-flow
Merge 9e3428c23 into 55a8e7b46
Pull Request #22718: Create tasks based on post types

3 of 69 new or added lines in 6 files covered. (4.35%)

17506 of 35648 relevant lines covered (49.11%)

3.87 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\Post_Type_Task_Interface;
7
use Yoast\WP\SEO\Task_List\Domain\Tasks\Task_Interface;
8

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

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

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

35
                $this->tasks = $tasks_with_id;
×
36
        }
37

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

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

61
                if ( ! $task instanceof Completeable_Task_Interface ) {
×
62
                        return null;
×
63
                }
64

65
                return $task;
×
66
        }
67

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