Yoast\WP\SEO\AI\Content_Planner\Domain
Post_List{}
List of posts.
Хуков нет.
Использование
$Post_List = new Post_List(); // use class methods
Методы
- public add( Post $post )
- public to_array()
Код Post_List{} Post List{} Yoast 27.8
class Post_List {
/**
* The posts.
*
* @var array<Post>
*/
private $posts = [];
/**
* Adds a post to the list.
*
* @param Post $post A post.
*
* @return void
*/
public function add( Post $post ): void {
$this->posts[] = $post;
}
/**
* Returns this object in array format.
*
* @return array<array<string, string|bool|array<string, int>>> The posts as an array.
*/
public function to_array(): array {
$result = [];
foreach ( $this->posts as $post ) {
$result[] = $post->to_array();
}
return $result;
}
}