Simplify `isset()` check in ControllerMap::resolve()
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 2 Jun 2022 10:03:52 +0000 (12:03 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 2 Jun 2022 10:03:52 +0000 (12:03 +0200)
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.

wcfsetup/install/files/lib/system/request/ControllerMap.class.php

index 8b58e68353137e80a1a0d8a67351f1e1915e9317..a65eae7c6a84f6eae91fecc992da37dd481f8c9a 100644 (file)
@@ -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];
                 }
             }
         }