Controllers: Add an else case to improve readability

This commit is contained in:
Sukhwinder Dhillon 2026-01-13 10:08:38 +01:00
parent d17c4501b2
commit 86b5557c1e
4 changed files with 18 additions and 18 deletions

View file

@ -26,12 +26,12 @@ class HostController extends CompatController
if ($host !== null) {
$this->redirectNow(Url::fromPath('icingadb/host')->setParams($this->params));
} else {
$this->getTabs()->disableLegacyExtensions();
$this->view->host = $hostName;
$this->view->tabs = null; // compatController already creates tabs
$this->addContent(HtmlString::create($this->view->render('ido-host/show.phtml')));
}
$this->getTabs()->disableLegacyExtensions();
$this->view->host = $hostName;
$this->view->tabs = null; // compatController already creates tabs
$this->addContent(HtmlString::create($this->view->render('ido-host/show.phtml')));
}
}

View file

@ -18,8 +18,8 @@ class IdoHostController extends Controller
$this->applyRestriction('monitoring/filter/objects', $query);
if ($query->fetchRow() !== false) {
$this->redirectNow(Url::fromPath('monitoring/host/show')->setParams($this->params));
} else {
$this->view->host = $hostName;
}
$this->view->host = $hostName;
}
}

View file

@ -20,9 +20,9 @@ class IdoServiceController extends Controller
$this->applyRestriction('monitoring/filter/objects', $query);
if ($query->fetchRow() !== false) {
$this->redirectNow(Url::fromPath('monitoring/service/show')->setParams($this->params));
} else {
$this->view->host = $hostName;
$this->view->service = $serviceName;
}
$this->view->host = $hostName;
$this->view->service = $serviceName;
}
}

View file

@ -31,13 +31,13 @@ class ServiceController extends CompatController
if ($service !== null) {
$this->redirectNow(Url::fromPath('icingadb/service')->setParams($this->params));
} else {
$this->getTabs()->disableLegacyExtensions();
$this->view->host = $hostName;
$this->view->service = $serviceName;
$this->view->tabs = null; // compatController already creates tabs
$this->addContent(HtmlString::create($this->view->render('ido-service/show.phtml')));
}
$this->getTabs()->disableLegacyExtensions();
$this->view->host = $hostName;
$this->view->service = $serviceName;
$this->view->tabs = null; // compatController already creates tabs
$this->addContent(HtmlString::create($this->view->render('ido-service/show.phtml')));
}
}