Yoast\WP\SEO\Task_List\Domain\Endpoint
Endpoint_List{}
List of endpoints.
Хуков нет.
Использование
$Endpoint_List = new Endpoint_List(); // use class methods
Методы
- public add_endpoint( Endpoint_Interface $endpoint )
- public to_array()
Код Endpoint_List{} 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;
}
}