|
|
@@ -36,7 +36,7 @@ class FreshRSS_Category extends Minz_Model {
|
|
|
/**
|
|
|
* @param array<FreshRSS_Feed>|null $feeds
|
|
|
*/
|
|
|
- public function __construct(string $name = '', array $feeds = null) {
|
|
|
+ public function __construct(string $name = '', ?array $feeds = null) {
|
|
|
$this->_name($name);
|
|
|
if ($feeds !== null) {
|
|
|
$this->_feeds($feeds);
|
|
|
@@ -99,7 +99,11 @@ class FreshRSS_Category extends Minz_Model {
|
|
|
return $this->nbNotRead;
|
|
|
}
|
|
|
|
|
|
- /** @return array<FreshRSS_Feed> */
|
|
|
+ /**
|
|
|
+ * @return array<FreshRSS_Feed>
|
|
|
+ * @throws Minz_ConfigurationNamespaceException
|
|
|
+ * @throws Minz_PDOConnectionException
|
|
|
+ */
|
|
|
public function feeds(): array {
|
|
|
if ($this->feeds === null) {
|
|
|
$feedDAO = FreshRSS_Factory::createFeedDao();
|
|
|
@@ -115,7 +119,7 @@ class FreshRSS_Category extends Minz_Model {
|
|
|
$this->sortFeeds();
|
|
|
}
|
|
|
|
|
|
- return $this->feeds;
|
|
|
+ return $this->feeds ?? [];
|
|
|
}
|
|
|
|
|
|
public function hasFeedsWithError(): bool {
|
|
|
@@ -266,6 +270,9 @@ class FreshRSS_Category extends Minz_Model {
|
|
|
}
|
|
|
|
|
|
private function sortFeeds(): void {
|
|
|
+ if ($this->feeds === null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
usort($this->feeds, static function (FreshRSS_Feed $a, FreshRSS_Feed $b) {
|
|
|
return strnatcasecmp($a->name(), $b->name());
|
|
|
});
|