$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;