aboutsummaryrefslogtreecommitdiff
path: root/classes/PluginHost.php
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2024-08-04 16:10:12 +0000
committerAndrew Dolgov <fox@fakecake.org>2024-08-04 16:10:12 +0000
commit3496402686224f3db921c91a1b25704ef26310ca (patch)
treecff043e8cbfe87cfff5cad9df42949609058ce65 /classes/PluginHost.php
parent6b521b5ed14dbc11bf9fecb40a2cd0ce541db9a8 (diff)
parent9dd4102c7fe2ddfc67f91ad9034d734a4458cc01 (diff)
Merge branch 'feature/isset-to-null-coalescing-op' into 'master'
Replace basic 'isset()' cases with the null coalescing operator. See merge request tt-rss/tt-rss!51
Diffstat (limited to 'classes/PluginHost.php')
-rw-r--r--classes/PluginHost.php23
1 files changed, 3 insertions, 20 deletions
diff --git a/classes/PluginHost.php b/classes/PluginHost.php
index 2098be4e6..f3febc431 100644
--- a/classes/PluginHost.php
+++ b/classes/PluginHost.php
@@ -586,11 +586,7 @@ class PluginHost {
$method = strtolower($method);
if (isset($this->handlers[$handler])) {
- if (isset($this->handlers[$handler]["*"])) {
- return $this->handlers[$handler]["*"];
- } else {
- return $this->handlers[$handler][$method];
- }
+ return $this->handlers[$handler]["*"] ?? $this->handlers[$handler][$method];
}
return false;
@@ -752,15 +748,8 @@ class PluginHost {
if ($profile_id) {
$idx = get_class($sender);
-
$this->load_data();
-
- if (isset($this->storage[$idx][$profile_id][$name])) {
- return $this->storage[$idx][$profile_id][$name];
- } else {
- return $default_value;
- }
-
+ return $this->storage[$idx][$profile_id][$name] ?? $default_value;
} else {
return $this->get($sender, $name, $default_value);
}
@@ -772,14 +761,8 @@ class PluginHost {
*/
function get(Plugin $sender, string $name, $default_value = false) {
$idx = get_class($sender);
-
$this->load_data();
-
- if (isset($this->storage[$idx][$name])) {
- return $this->storage[$idx][$name];
- } else {
- return $default_value;
- }
+ return $this->storage[$idx][$name] ?? $default_value;
}
/**