PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.3
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / task-list / domain / tasks / abstract-child-task.php

abstract-child-task.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.3, at src/task-list/domain/tasks/abstract-child-task.php

45 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 use Yoast\WP\SEO\Task_List\Domain\Components\Task_Analyzer_Interface;
6
7 /**
8 * Abstract class for a child task.
9 * Use this when you need a task that belongs to a parent task.
10 */
11 abstract class Abstract_Child_Task extends Abstract_Task implements Child_Task_Interface {
12
13 /**
14 * The parent task associated with the task.
15 *
16 * @var Parent_Task_Interface
17 */
18 protected $parent_task;
19
20 /**
21 * Returns the task's analyzer component.
22 *
23 * @return Task_Analyzer_Interface|null
24 */
25 public function get_analyzer(): ?Task_Analyzer_Interface {
26 return null;
27 }
28
29 /**
30 * Returns an array representation of the task data.
31 *
32 * @return array<string, string|bool|int|array|null> Returns in an array format.
33 */
34 public function to_array(): array {
35 $data = parent::to_array();
36
37 $analyzer = $this->get_analyzer();
38
39 $data['parentTaskId'] = $this->parent_task->get_id();
40 $data['analyzer'] = ( $analyzer !== null ) ? $analyzer->to_array() : null;
41
42 return $data;
43 }
44 }
45