Yoast\WP\SEO

Main{}Yoast 1.0

Class Main.

Хуков нет.

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

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

Методы

  1. protected get_container()
  2. protected get_name()
  3. protected get_surfaces()

Код Main{} Yoast 22.4

class Main extends Abstract_Main {

	/**
	 * The API namespace constant.
	 *
	 * @var string
	 */
	public const API_V1_NAMESPACE = 'yoast/v1';

	/**
	 * The WP CLI namespace constant.
	 *
	 * @var string
	 */
	public const WP_CLI_NAMESPACE = 'yoast';

	/**
	 * {@inheritDoc}
	 */
	protected function get_container() {
		if ( $this->is_development() && \class_exists( '\Yoast\WP\SEO\Dependency_Injection\Container_Compiler' ) ) {
			// Exception here is unhandled as it will only occur in development.
			Container_Compiler::compile(
				$this->is_development(),
				__DIR__ . '/generated/container.php',
				__DIR__ . '/../config/dependency-injection/services.php',
				__DIR__ . '/../vendor/composer/autoload_classmap.php',
				'Yoast\WP\SEO\Generated'
			);
		}

		if ( \file_exists( __DIR__ . '/generated/container.php' ) ) {
			require_once __DIR__ . '/generated/container.php';

			return new Cached_Container();
		}

		return null;
	}

	/**
	 * {@inheritDoc}
	 */
	protected function get_name() {
		return 'yoast-seo';
	}

	/**
	 * {@inheritDoc}
	 */
	protected function get_surfaces() {
		return [
			'classes' => Classes_Surface::class,
			'meta'    => Meta_Surface::class,
			'helpers' => Helpers_Surface::class,
		];
	}
}