Yoast\WP\SEO\Llms_Txt\Application\Health_Check

File_Runner{}Yoast 1.0└─ Runner_Interface

Runs the File_Generation health check.

Хуков нет.

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

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

Методы

  1. public get_generation_failure_reason()
  2. public is_successful()
  3. public run()

Код File_Runner{} Yoast 27.7

class File_Runner implements Runner_Interface {

	/**
	 * Is set to non-empty string when the llms.txt file failed to (re-)generate.
	 *
	 * @var bool
	 */
	private $generation_failure_reason = '';

	/**
	 * Runs the health check.
	 *
	 * @return void
	 */
	public function run() {
		$this->generation_failure_reason = \get_option( Populate_File_Command_Handler::GENERATION_FAILURE_OPTION, '' );
	}

	/**
	 * Returns true if there is no generation failure reason.
	 *
	 * @return bool The boolean indicating if the health check was succesful.
	 */
	public function is_successful() {
		return $this->generation_failure_reason === '';
	}

	/**
	 * Returns the generation failure reason.
	 *
	 * @return string The boolean indicating if the health check was succesful.
	 */
	public function get_generation_failure_reason(): string {
		return $this->generation_failure_reason;
	}
}