Yoast\WP\SEO\Task_List\Domain\Components

Abstract_Task_Analyzer{}abstractYoast 1.0└─ Task_Analyzer_Interface

Abstract class for a task analyzer.

Хуков нет.

Использование

$Abstract_Task_Analyzer = new Abstract_Task_Analyzer();
// use class methods

Методы

  1. public to_array()

Код Abstract_Task_Analyzer{} Yoast 28.3

abstract class Abstract_Task_Analyzer implements Task_Analyzer_Interface {

	/**
	 * The title of the analyzer (e.g. "SEO analysis").
	 *
	 * @var string
	 */
	protected $title;

	/**
	 * The result of the analyzer.
	 *
	 * @var string
	 */
	protected $result;

	/**
	 * The human-readable label for the result (e.g. "Needs improvement").
	 *
	 * @var string
	 */
	protected $result_label;

	/**
	 * The description text explaining the result.
	 *
	 * @var string
	 */
	protected $result_description;

	/**
	 * Returns an array representation of the analyzer data.
	 *
	 * @return array<string, string> Returns in an array format.
	 */
	public function to_array(): array {
		return [
			'type'              => $this->get_type(),
			'title'             => $this->title,
			'result'            => $this->result,
			'resultLabel'       => $this->result_label,
			'resultDescription' => $this->result_description,
		];
	}
}