From 1a990116a564032b01db7c263c71d79c8096c2f8 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Tue, 27 Feb 2018 00:07:29 -0500 Subject: [PATCH] Output of getCategories() should be a CategoryCollection --- lib/Feed.php | 4 ++-- lib/JSON/Feed.php | 7 ++++--- lib/XML/Feed.php | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/Feed.php b/lib/Feed.php index 1dcdf75..d3d004f 100644 --- a/lib/Feed.php +++ b/lib/Feed.php @@ -6,8 +6,8 @@ declare(strict_types=1); namespace JKingWeb\Lax; -use JKingWeb\Lax\Person\Person; use JKingWeb\Lax\Person\Collection as PersonCollection; +use JKingWeb\Lax\Category\Collection as CategoryCollection; abstract class Feed { protected $reqUrl; @@ -61,7 +61,7 @@ abstract class Feed { * * The $humanFriendly parameter only affects Atom categories */ - abstract public function getCategories(): array; + abstract public function getCategories(): CategoryCollection; /** General function to fetch the feed identifier */ abstract public function getId(): string; diff --git a/lib/JSON/Feed.php b/lib/JSON/Feed.php index da4faec..a1ee222 100644 --- a/lib/JSON/Feed.php +++ b/lib/JSON/Feed.php @@ -8,6 +8,7 @@ namespace JKingWeb\Lax\JSON; use JKingWeb\Lax\Person\Person; use JKingWeb\Lax\Person\Collection as PersonCollection; +use JKingWeb\Lax\Category\Collection as CategoryCollection; class Feed extends \JKingWeb\Lax\Feed { use Construct; @@ -52,10 +53,10 @@ class Feed extends \JKingWeb\Lax\Feed { /** General function to fetch the categories of a feed * - * JSON Feed does not have categories at the feed level, so this always returns an empty array + * JSON Feed does not have categories at the feed level, so this always returns an empty collection */ - public function getCategories(bool $grouped = false, bool $humanFriendly = true): array { - return []; + public function getCategories(): CategoryCollection { + return new CategoryCollection; } /** General function to fetch the feed identifier diff --git a/lib/XML/Feed.php b/lib/XML/Feed.php index ee407e3..8d43629 100644 --- a/lib/XML/Feed.php +++ b/lib/XML/Feed.php @@ -6,8 +6,8 @@ declare(strict_types=1); namespace JKingWeb\Lax\XML; -use JKingWeb\Lax\Person\Person; use JKingWeb\Lax\Person\Collection as PersonCollection; +use JKingWeb\Lax\Category\Collection as CategoryCollection; class Feed extends \JKingWeb\Lax\Feed { use Construct; @@ -85,8 +85,8 @@ class Feed extends \JKingWeb\Lax\Feed { * * The $humanFriendly parameter only affects Atom categories */ - public function getCategories(): array { - return $this->getCategoriesAtom() ?? $this->getCategoriesRss2() ?? $this->getCategoriesDC() ?? $this->getCategoriesPod() ?? []; + public function getCategories(): CategoryCollection { + return $this->getCategoriesAtom() ?? $this->getCategoriesRss2() ?? $this->getCategoriesDC() ?? $this->getCategoriesPod() ?? new CategoryCollection; } /** General function to fetch the feed identifier */