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

Yoast / wordpress-seo / 659e37133290e0f2694685341c70f7fb592085ed

22 Jan 2026 11:28AM UTC coverage: 41.982%. First build
659e37133290e0f2694685341c70f7fb592085ed

Pull #22891

github

web-flow
Merge bd73a3470 into d721a7aa0
Pull Request #22891: Create the endpoints needed for the Improve your content's SEO task

2676 of 9801 branches covered (27.3%)

Branch coverage included in aggregate %.

17 of 156 new or added lines in 15 files covered. (10.9%)

23216 of 51873 relevant lines covered (44.76%)

4.75 hits per line

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

0.0
/src/task-list/domain/tasks/parent-task-trait.php
1
<?php
2
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3
namespace Yoast\WP\SEO\Task_List\Domain\Tasks;
4

5
/**
6
 * Trait for parent task functionality.
7
 * Provides the implementation for Parent_Task_Interface methods.
8
 */
9
trait Parent_Task_Trait {
10

11
        /**
12
         * The child tasks associated with the task.
13
         *
14
         * @var Child_Task_Interface[]
15
         */
16
        protected $child_tasks = [];
17

18
        /**
19
         * Returns the child tasks associated with the task.
20
         *
21
         * @return Child_Task_Interface[]
22
         */
NEW
23
        public function get_child_tasks(): array {
×
NEW
24
                return $this->child_tasks;
×
25
        }
26

27
        /**
28
         * Returns whether this task is completed.
29
         * The parent task is completed when all child tasks are completed.
30
         *
31
         * @return bool Whether this task is completed.
32
         */
NEW
33
        public function get_is_completed(): bool {
×
NEW
34
                $child_tasks = $this->child_tasks;
×
35

NEW
36
                if ( empty( $child_tasks ) ) {
×
NEW
37
                        return true;
×
38
                }
39

NEW
40
                foreach ( $child_tasks as $task ) {
×
NEW
41
                        if ( ! $task->get_is_completed() ) {
×
NEW
42
                                return false;
×
43
                        }
44
                }
45

NEW
46
                return true;
×
47
        }
48

49
        /**
50
         * Generates and sets the child tasks.
51
         *
52
         * @return Child_Task_Interface[] The generated child tasks.
53
         */
NEW
54
        public function generate_child_tasks(): array {
×
NEW
55
                $this->child_tasks = $this->populate_child_tasks();
×
56

NEW
57
                return $this->child_tasks;
×
58
        }
59

60
        /**
61
         * Returns an array representation of the task data.
62
         * When used in a class extending Abstract_Task, this will call the parent's to_array()
63
         * and add the parent task flag.
64
         *
65
         * @return array<string, string|bool> Returns in an array format.
66
         */
NEW
67
        public function to_array(): array {
×
NEW
68
                $data = [];
×
69

NEW
70
                $parent_class = \get_parent_class( $this );
×
NEW
71
                if ( $parent_class !== false && \method_exists( $parent_class, 'to_array' ) ) {
×
NEW
72
                        $data = parent::to_array();
×
73
                }
74

NEW
75
                $data['parentTask'] = true;
×
76

NEW
77
                return $data;
×
78
        }
79
}
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