mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 17:24:16 +02:00
Prefer switch rather than if - elseif
This commit is contained in:
parent
1902b4f10f
commit
af898cc2b3
@ -233,11 +233,14 @@ class ConfigController extends BaseConfigController
|
|||||||
|
|
||||||
$backendType = $this->getRequest()->getParam('type');
|
$backendType = $this->getRequest()->getParam('type');
|
||||||
$authenticationConfig = IcingaConfig::app('authentication')->toArray();
|
$authenticationConfig = IcingaConfig::app('authentication')->toArray();
|
||||||
if ($backendType === 'ldap') {
|
switch ($backendType) {
|
||||||
|
case 'ldap':
|
||||||
$form = new LdapBackendForm();
|
$form = new LdapBackendForm();
|
||||||
} else if ($backendType === 'db') {
|
break;
|
||||||
|
case 'db':
|
||||||
$form = new DbBackendForm();
|
$form = new DbBackendForm();
|
||||||
} else if ($backendType === 'autologin') {
|
break;
|
||||||
|
case 'autologin':
|
||||||
$existing = array_filter($authenticationConfig, function ($e) { return $e['backend'] === 'autologin'; });
|
$existing = array_filter($authenticationConfig, function ($e) { return $e['backend'] === 'autologin'; });
|
||||||
if (false === empty($existing)) {
|
if (false === empty($existing)) {
|
||||||
$this->addErrorMessage(
|
$this->addErrorMessage(
|
||||||
@ -246,7 +249,8 @@ class ConfigController extends BaseConfigController
|
|||||||
$this->redirectNow('config/configurationerror');
|
$this->redirectNow('config/configurationerror');
|
||||||
}
|
}
|
||||||
$form = new AutologinBackendForm();
|
$form = new AutologinBackendForm();
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
$this->addErrorMessage(sprintf(
|
$this->addErrorMessage(sprintf(
|
||||||
$this->translate('There is no backend type `%s\''),
|
$this->translate('There is no backend type `%s\''),
|
||||||
$backendType
|
$backendType
|
||||||
|
Loading…
x
Reference in New Issue
Block a user