diff --git a/php/model/LocalArticleManager.php b/php/model/LocalArticleManager.php index b3e84cd..f686127 100644 --- a/php/model/LocalArticleManager.php +++ b/php/model/LocalArticleManager.php @@ -97,5 +97,25 @@ class LocalArticleManager implements ArticleManagerDAO { return is_array($articles) ? $articles : []; } + public function getArticlesByAuthor($author) + { + $articles = $this->getAllArticles(); + $filteredArticles = []; + + foreach ($articles as $article) { + if (isset($article['author']) && $article['author'] == $author) { + $filteredArticles[] = new Article( + intval($article['id']), + $article['title'], + $article['content'], + $article['author'], + $article['category'], + $article['tags'], + $article['creationDate'] + ); + } + } + return $filteredArticles; + } } ?> \ No newline at end of file