summaryrefslogtreecommitdiffstats
path: root/app/classes/Planet.php
diff options
context:
space:
mode:
authorrdalverny <rdalverny@gmail.com>2022-01-22 19:53:01 +0100
committerrdalverny <rdalverny@gmail.com>2022-01-22 19:53:01 +0100
commit5a0c2d333ff41ec4da6a4d58bc1553beeee1affa (patch)
treea6f2f62d76535a2e47085173c560be77b0214e15 /app/classes/Planet.php
parentc27c9d1d359828a071159995689c9c3b28d99891 (diff)
downloadplanet-5a0c2d333ff41ec4da6a4d58bc1553beeee1affa.tar
planet-5a0c2d333ff41ec4da6a4d58bc1553beeee1affa.tar.gz
planet-5a0c2d333ff41ec4da6a4d58bc1553beeee1affa.tar.bz2
planet-5a0c2d333ff41ec4da6a4d58bc1553beeee1affa.tar.xz
planet-5a0c2d333ff41ec4da6a4d58bc1553beeee1affa.zip
More type hints
Diffstat (limited to 'app/classes/Planet.php')
-rw-r--r--app/classes/Planet.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/app/classes/Planet.php b/app/classes/Planet.php
index 1555c25..0bb4b32 100644
--- a/app/classes/Planet.php
+++ b/app/classes/Planet.php
@@ -75,13 +75,13 @@ class Planet
* @param string $supplied
* @return bool
*/
- public static function authenticateUser(string $known = '', string $supplied = '')
+ public static function authenticateUser(string $known = '', string $supplied = '') : bool
{
return hash_equals($known, $supplied);
}
/**
- * @return array $items
+ * @return array<PlanetItem> $items
*/
public function getFeedsItems()
{
@@ -95,6 +95,8 @@ class Planet
/**
* Getters
+ *
+ * @return array<int, PlanetItem>
*/
public function getItems()
{
@@ -106,6 +108,9 @@ class Planet
return $this->items;
}
+ /**
+ * @return array<PlanetFeed>
+ */
public function getPeople()
{
return $this->people;
@@ -115,6 +120,7 @@ class Planet
* Adds a feed to the planet.
*
* @param PlanetFeed $feed
+ * @return void
*/
public function addPerson(&$feed)
{
@@ -150,6 +156,7 @@ class Planet
/**
* Load feeds
+ * @return void
*/
public function loadFeeds()
{
@@ -168,6 +175,7 @@ class Planet
* Fetch feeds and see if new data is present.
*
* @param float $max_load Percentage of feeds to load
+ * @return void
*/
public function download($max_load = 0.1)
{
@@ -215,6 +223,9 @@ class Planet
OpmlManager::save($opml, $this->config->getOpmlFile());
}
+ /**
+ * @return void
+ */
public function sort()
{
usort($this->items, array('PlanetItem','compare'));
@@ -226,13 +237,13 @@ class Planet
*
* If there's no category, return all items.
*
- * @param array $items to filter
+ * @param array<PlanetItem> $items to filter
* @param string $categories to filter against; may be a single word
* or a comma-separated list of words.
*
- * @return array resulting list of items
+ * @return array<PlanetItem> resulting list of items
*/
- public function _filterItemsByCategory($items, $categories = null)
+ public function _filterItemsByCategory(array $items, string $categories = null)
{
if (is_null($categories) or empty(trim($categories))) {
return $items;