]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/main/resolver/controller/web/class_WebControllerResolver.php
Image controller/resolver and fixes:
[shipsimu.git] / inc / classes / main / resolver / controller / web / class_WebControllerResolver.php
index ca1aa9204b529a4294a6c243424cda5ebbd90c01..777f8edd926946998c3932c79c8cc11e18848e75 100644 (file)
@@ -70,7 +70,7 @@ class WebControllerResolver extends BaseControllerResolver implements Controller
                        throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } elseif (!$resolverInstance->isControllerValid($controllerName)) {
                        // Invalid command found
-                       throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_COMMAND);
+                       throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
                }
 
                // Set the application instance
@@ -122,7 +122,7 @@ class WebControllerResolver extends BaseControllerResolver implements Controller
         *
         * @param       $controllerName                 A controller name we shall look for
         * @return      $controllerInstance             A loaded controller instance
-        * @throws      DefaultControllerException      Thrown if even the default
+        * @throws      InvalidControllerException      Thrown if even the requested
         *                                                                              controller class is missing (bad!)
         */
        private function loadController ($controllerName) {
@@ -130,7 +130,7 @@ class WebControllerResolver extends BaseControllerResolver implements Controller
                 //* DEBUG: */ $this->debugBackTrace();
 
                // Cache default command
-               $defaultController = $this->getConfigInstance()->readConfig('default_command');
+               $defaultController = $this->getConfigInstance()->readConfig('default_web_command');
 
                // Init controller instance
                $controllerInstance = null;
@@ -156,14 +156,8 @@ class WebControllerResolver extends BaseControllerResolver implements Controller
 
                // Is this class loaded?
                if (!class_exists($this->getClassName())) {
-                       // Class not found, so try the default one or throw exception
-                       if ($controllerName != $defaultController) {
-                               // Try the default controller
-                               return $this->loadController($defaultController);
-                       } else {
-                               // Still not found?
-                               throw new DefaultControllerException($this, self::EXCEPTION_DEFAUL_CONTROLLER_GONE);
-                       }
+                       // Throw an exception here
+                       throw new InvalidControllerException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
                } // END - if
 
                // Initiate the resolver and controller