diff options
author | Simon Rettberg | 2023-11-02 19:08:58 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-11-02 19:08:58 +0100 |
commit | c2d95ffaeaa289752b4c7b6664b6ca112a02e350 (patch) | |
tree | 2c29b0157d14198aadbdbc9f8c18ded0bd4dadcd /modules-available/serversetup-bwlp-ipxe/page.inc.php | |
parent | [rebootcontrol] Remove API prototype (diff) | |
download | slx-admin-c2d95ffaeaa289752b4c7b6664b6ca112a02e350.tar.gz slx-admin-c2d95ffaeaa289752b4c7b6664b6ca112a02e350.tar.xz slx-admin-c2d95ffaeaa289752b4c7b6664b6ca112a02e350.zip |
Roundup of issues reported by PHPStorm
Mostly redundant checks, logic errors, dead code, etc.
Diffstat (limited to 'modules-available/serversetup-bwlp-ipxe/page.inc.php')
-rw-r--r-- | modules-available/serversetup-bwlp-ipxe/page.inc.php | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/page.inc.php b/modules-available/serversetup-bwlp-ipxe/page.inc.php index 4e104e78..8d4a366f 100644 --- a/modules-available/serversetup-bwlp-ipxe/page.inc.php +++ b/modules-available/serversetup-bwlp-ipxe/page.inc.php @@ -615,7 +615,7 @@ class Page_ServerSetup extends Page $error = $status['error'] ?? 'Unknown error'; } Render::addTemplate('ipaddress', array( - 'ips' => $this->addrListTask['data']['addresses'], + 'ips' => $this->addrListTask['data']['addresses'] ?? [], 'chooseHintClass' => $this->hasIpSet ? '' : 'alert alert-danger', 'disabled' => ($this->getCompileTask() === false) ? '' : 'disabled', 'versions' => $versions, @@ -626,13 +626,13 @@ class Page_ServerSetup extends Page // ----------------------------------------------------------------------------------------------- - private function getLocalAddresses() + private function getLocalAddresses(): void { $this->addrListTask = Taskmanager::submit('LocalAddressesList', array()); if ($this->addrListTask === false) { $this->addrListTask['data']['addresses'] = false; - return false; + return; } if (!Taskmanager::isFinished($this->addrListTask)) { // TODO: Async if just displaying @@ -641,12 +641,12 @@ class Page_ServerSetup extends Page if (Taskmanager::isFailed($this->addrListTask) || !isset($this->addrListTask['data']['addresses'])) { $this->addrListTask['data']['addresses'] = false; - return false; + return; } $sortIp = array(); foreach (array_keys($this->addrListTask['data']['addresses']) as $key) { - $item = & $this->addrListTask['data']['addresses'][$key]; + $item =& $this->addrListTask['data']['addresses'][$key]; if (!isset($item['ip']) || !preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $item['ip']) || substr($item['ip'], 0, 4) === '127.') { unset($this->addrListTask['data']['addresses'][$key]); continue; @@ -659,7 +659,6 @@ class Page_ServerSetup extends Page } unset($item); array_multisort($sortIp, SORT_STRING, $this->addrListTask['data']['addresses']); - return true; } private function deleteBootEntry() @@ -836,7 +835,7 @@ class Page_ServerSetup extends Page { $newAddress = Request::post('ip', 'none', 'string'); $valid = false; - foreach ($this->addrListTask['data']['addresses'] as $item) { + foreach ($this->addrListTask['data']['addresses'] ?? [] as $item) { if ($item['ip'] !== $newAddress) continue; $valid = true; |