| 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 |
/** |
| 7 |
* Abstract class for a task analyzer. |
| 8 |
*/ |
| 9 |
abstract class Abstract_Task_Analyzer implements Task_Analyzer_Interface { |
| 10 |
|
| 11 |
/** |
| 12 |
* The title of the analyzer (e.g. "SEO analysis"). |
| 13 |
* |
| 14 |
* @var string |
| 15 |
*/ |
| 16 |
protected $title; |
| 17 |
|
| 18 |
/** |
| 19 |
* The result of the analyzer. |
| 20 |
* |
| 21 |
* @var string |
| 22 |
*/ |
| 23 |
protected $result; |
| 24 |
|
| 25 |
/** |
| 26 |
* The human-readable label for the result (e.g. "Needs improvement"). |
| 27 |
* |
| 28 |
* @var string |
| 29 |
*/ |
| 30 |
protected $result_label; |
| 31 |
|
| 32 |
/** |
| 33 |
* The description text explaining the result. |
| 34 |
* |
| 35 |
* @var string |
| 36 |
*/ |
| 37 |
protected $result_description; |
| 38 |
|
| 39 |
/** |
| 40 |
* Returns an array representation of the analyzer data. |
| 41 |
* |
| 42 |
* @return array<string, string> Returns in an array format. |
| 43 |
*/ |
| 44 |
public function to_array(): array { |
| 45 |
return [ |
| 46 |
'type' => $this->get_type(), |
| 47 |
'title' => $this->title, |
| 48 |
'result' => $this->result, |
| 49 |
'resultLabel' => $this->result_label, |
| 50 |
'resultDescription' => $this->result_description, |
| 51 |
]; |
| 52 |
} |
| 53 |
} |
| 54 |
|