Yoast\WP\SEO\Task_List\Domain\Endpoint

Endpoint_List{}Yoast 1.0

List of endpoints.

Хуков нет.

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

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

Методы

  1. public add_endpoint( Endpoint_Interface $endpoint )
  2. public to_array()

Код Endpoint_List{} Yoast 26.9

class Endpoint_List {

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

	/**
	 * Adds an endpoint to the list.
	 *
	 * @param Endpoint_Interface $endpoint An endpoint.
	 *
	 * @return void
	 */
	public function add_endpoint( Endpoint_Interface $endpoint ): void {
		$this->endpoints[] = $endpoint;
	}

	/**
	 * Converts the list to an array.
	 *
	 * @return array<string, string> The array of endpoints.
	 */
	public function to_array(): array {
		$result = [];
		foreach ( $this->endpoints as $endpoint ) {
			$result[ $endpoint->get_name() ] = $endpoint->get_url();
		}

		return $result;
	}
}