summaryrefslogtreecommitdiff
path: root/classes/pluginhost.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-09 10:20:58 +0300
committerAndrew Dolgov <[email protected]>2021-02-09 10:20:58 +0300
commita5819569f22cccfe602c57b86f4e3896dc5cfaf6 (patch)
tree7188528561d418196833bdd7d30cfe60833de88c /classes/pluginhost.php
parent6a25bc53efd7804a1c8e1777cf1938880983501e (diff)
pluginhost: a few more warnings and type hints
Diffstat (limited to 'classes/pluginhost.php')
-rwxr-xr-xclasses/pluginhost.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index b6c8aa214..42f7f6bf9 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -533,13 +533,15 @@ class PluginHost {
// Plugin feed functions are *EXPERIMENTAL*!
// cat_id: only -1 is supported (Special)
- function add_feed(int $cat_id, $title, $icon, Plugin $sender) {
- if (!$this->feeds[$cat_id]) $this->feeds[$cat_id] = array();
+ function add_feed(int $cat_id, string $title, string $icon, Plugin $sender) {
+
+ if (empty($this->feeds[$cat_id]))
+ $this->feeds[$cat_id] = [];
$id = count($this->feeds[$cat_id]);
array_push($this->feeds[$cat_id],
- array('id' => $id, 'title' => $title, 'sender' => $sender, 'icon' => $icon));
+ ['id' => $id, 'title' => $title, 'sender' => $sender, 'icon' => $icon]);
return $id;
}
@@ -549,7 +551,7 @@ class PluginHost {
}
// convert feed_id (e.g. -129) to pfeed_id first
- function get_feed_handler($pfeed_id) {
+ function get_feed_handler(int $pfeed_id) {
foreach ($this->feeds as $cat) {
foreach ($cat as $feed) {
if ($feed['id'] == $pfeed_id) {
@@ -559,11 +561,11 @@ class PluginHost {
}
}
- static function pfeed_to_feed_id($pfeed) {
+ static function pfeed_to_feed_id(int $pfeed) {
return PLUGIN_FEED_BASE_INDEX - 1 - abs($pfeed);
}
- static function feed_to_pfeed_id($feed) {
+ static function feed_to_pfeed_id(int $feed) {
return PLUGIN_FEED_BASE_INDEX - 1 + abs($feed);
}