Yoast\WP\SEO\Dashboard\Application\Endpoints

Endpoints_Repository{}Yoast 1.0

Repository for endpoints.

Хуков нет.

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

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

Методы

  1. public __construct( Endpoint_Interface ...$endpoints )
  2. public get_all_endpoints()

Код Endpoints_Repository{} Yoast 24.4

class Endpoints_Repository {

	/**
	 * Holds the endpoints.
	 *
	 * @var array<Endpoint_Interface>
	 */
	private $endpoints;

	/**
	 * Constructs the repository.
	 *
	 * @param Endpoint_Interface ...$endpoints The endpoints to add to the repository.
	 */
	public function __construct( Endpoint_Interface ...$endpoints ) {
		$this->endpoints = $endpoints;
	}

	/**
	 * Creates a list with all endpoints.
	 *
	 * @return Endpoint_List The list with all endpoints.
	 */
	public function get_all_endpoints(): Endpoint_List {
		$list = new Endpoint_List();
		foreach ( $this->endpoints as $endpoint ) {
			$list->add_endpoint( $endpoint );
		}

		return $list;
	}
}