From: Tim Düsterhus Date: Thu, 2 Jun 2022 10:03:52 +0000 (+0200) Subject: Simplify `isset()` check in ControllerMap::resolve() X-Git-Tag: 6.0.0_Alpha_1~1216 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e704adf201fb2cb333266be3c068ae6889b2bd7a;p=GitHub%2FWoltLab%2FWCF.git Simplify `isset()` check in ControllerMap::resolve() The first test was a prefix of the second, thus it is implicitly checked. Also run the `wcf` check in all cases, while this might check the same entry twice for `$application == 'wcf'`, this will not have a relevant performance impact and make the code much more readable. --- diff --git a/wcfsetup/install/files/lib/system/request/ControllerMap.class.php b/wcfsetup/install/files/lib/system/request/ControllerMap.class.php index 8b58e68353..a65eae7c6a 100644 --- a/wcfsetup/install/files/lib/system/request/ControllerMap.class.php +++ b/wcfsetup/install/files/lib/system/request/ControllerMap.class.php @@ -110,18 +110,11 @@ class ControllerMap extends SingletonFactory // handle controllers with a custom url $controller = $classData['controller']; - if ( - isset($this->customUrls['reverse'][$application]) - && isset($this->customUrls['reverse'][$application][$controller]) - ) { + if (isset($this->customUrls['reverse'][$application][$controller])) { return $this->customUrls['reverse'][$application][$controller]; - } elseif ($application !== 'wcf') { - if ( - isset($this->customUrls['reverse']['wcf']) - && isset($this->customUrls['reverse']['wcf'][$controller]) - ) { - return $this->customUrls['reverse']['wcf'][$controller]; - } + } + if (isset($this->customUrls['reverse']['wcf'][$controller])) { + return $this->customUrls['reverse']['wcf'][$controller]; } } }