Make ControllerMap::isLandingPage() take a className, not a classData array
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 20 May 2022 12:46:47 +0000 (14:46 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 20 May 2022 12:58:46 +0000 (14:58 +0200)
It is only interested in the className field of the given array and taking a
className directly makes the API clearer.

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

index ca63a1b467a68fbc1eb752a85439d6a0d0fcc6ba..29914b761fdf291fab614e4372ab11b968bbe201 100644 (file)
@@ -354,17 +354,16 @@ class ControllerMap extends SingletonFactory
     /**
      * Returns true if currently active request represents the landing page.
      *
-     * @param string[] $classData
      * @param array $metaData
      * @return  bool
      */
-    public function isLandingPage(array $classData, array $metaData)
+    public function isLandingPage(string $className, array $metaData)
     {
-        if ($classData['className'] !== $this->landingPages['wcf'][2]) {
+        if ($className !== $this->landingPages['wcf'][2]) {
             return false;
         }
 
-        if ($classData['className'] === CmsPage::class) {
+        if ($className === CmsPage::class) {
             // check if page id matches
             if ($this->landingPages['wcf'][1] !== '__WCF_CMS__' . $metaData['cms']['pageID']) {
                 return false;
index d8f20d340b18f3c49b529eb9755439c6bdde8322..bdded4e2139d8fed4b2bc8b7a08d75bf049219f0 100644 (file)
@@ -212,7 +212,7 @@ final class RequestHandler extends SingletonFactory
 
             if (!$this->isACPRequest()) {
                 // determine if current request matches the landing page
-                if (ControllerMap::getInstance()->isLandingPage($classData, $metaData)) {
+                if (ControllerMap::getInstance()->isLandingPage($classData['className'], $metaData)) {
                     $this->activeRequest->setIsLandingPage();
                 }
             }