posts[] = $post; } /** * Returns the posts in the list. * * @return Post[] The posts in the list. */ public function get(): array { return $this->posts; } /** * Parses the post list to the expected key value representation. * * @return array> The post list presented as the expected key value representation. */ public function to_array(): array { return \array_map( static function ( Post $post ) { return $post->to_array(); }, $this->posts, ); } }