X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fresolver%2Fweb%2Fclass_WebControllerResolver.php;h=1debf14ae63cd83d2df6ccab8e135ed2db13eed3;hp=6dd5a39fe25a8c54d0782c7f75c91fed272098a3;hb=c983485aaafb177a8dd366a7f7c0fd5db6720d55;hpb=8cfd068024443570a0f324e4271637537cff2d88 diff --git a/inc/classes/main/resolver/web/class_WebControllerResolver.php b/inc/classes/main/resolver/web/class_WebControllerResolver.php index 6dd5a39..1debf14 100644 --- a/inc/classes/main/resolver/web/class_WebControllerResolver.php +++ b/inc/classes/main/resolver/web/class_WebControllerResolver.php @@ -95,31 +95,26 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver { $commandName = ""; $controllerInstance = null; - // Try to resolv the command - try { - // Get the command name - $commandName = $this->getCommandName(); - - // Check if the command is valid - if (!$this->isCommandValid($commandName)) { - // This command is invalid! - throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND); - } + // Get the command name + $commandName = $this->getCommandName(); - // Get the command - $controllerInstance = $this->loadController($commandName); + // Check if the command is valid + if (!$this->isCommandValid($commandName)) { + // This command is invalid! + throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND); + } // END - if - // And validate it - if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) { - // This command has an invalid instance! - throw new InvalidControllerInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_CONTROLLER); - } + // Get the command + $controllerInstance = $this->loadController($commandName); - // Set last controller - $this->lastControllerInstance = $controllerInstance; - } catch (MissingArrayElementsException $e) { - // Just catch it here... - } + // And validate it + if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) { + // This command has an invalid instance! + throw new InvalidControllerInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_CONTROLLER); + } // END - if + + // Set last controller + $this->lastControllerInstance = $controllerInstance; // Return the maybe resolved instance return $controllerInstance;