Simplify switch statement in dhcp

This commit is contained in:
Ely Deckers 2022-02-19 11:58:04 +01:00
parent 3b0cd404a4
commit f47110d1b5
1 changed files with 3 additions and 11 deletions

View File

@ -1277,18 +1277,10 @@ class PfzCommands
asort($pools);
}
switch ($value_key) {
case "pools":
return $pools;
break;
case "failover":
return $failover;
break;
case "leases":
default:
return $leases;
}
$rs = compact("pools", "failover", "leases");
$is_known_value_key = array_key_exists($value_key, $rs);
return ($is_known_value_key) ? $rs[$value_key] : $leases;
}
private static function check_dhcp_failover(): int