readable(Article $article): bool { return $article->getPublishedAt() <= (new \DateTime()); } function to_result(Article $article): array { return [ 'author' => $article->getAuthor(), 'content' => $article->getContent(), 'publishedAt' => $article->getPublishedAt(), ]; } function list_articles(): Response { return new Response(array_map( 'to_result', array_filter(retrieve_articles(), 'readable'), )); } 55