X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fresolver%2Fweb%2Fclass_WebCommandResolver.php;h=ba0eb1563553ebd36c028a82c24a7c8d11930f3a;hp=f4b87a2b30c7967e36bc25d5fc7e15877e6834f9;hb=c983485aaafb177a8dd366a7f7c0fd5db6720d55;hpb=8cfd068024443570a0f324e4271637537cff2d88 diff --git a/inc/classes/main/resolver/web/class_WebCommandResolver.php b/inc/classes/main/resolver/web/class_WebCommandResolver.php index f4b87a2..ba0eb15 100644 --- a/inc/classes/main/resolver/web/class_WebCommandResolver.php +++ b/inc/classes/main/resolver/web/class_WebCommandResolver.php @@ -77,7 +77,7 @@ class WebCommandResolver extends BaseResolver implements CommandResolver { /** * Returns an command instance for a given request class or null if - * MissingArrayElementsException was thrown + * it was not found * * @param $requestInstance An instance of a request class * @return $commandInstance An instance of the resolved command @@ -91,34 +91,29 @@ class WebCommandResolver extends BaseResolver implements CommandResolver { $commandName = ""; $commandInstance = null; - // Test if the required parameter is set - try { - // This goes fine so let's resolv the command - $commandName = $requestInstance->getRequestElement("page"); + // This goes fine so let's resolv the command + $commandName = $requestInstance->getRequestElement("page"); - // Is the command empty? Then fall back to default command - if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_command'); + // Is the command empty? Then fall back to default command + if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_command'); - // Check if the command is valid - if (!$this->isCommandValid($commandName)) { - // This command is invalid! - throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND); - } + // 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 - // Get the command - $commandInstance = $this->loadCommand($commandName); + // Get the command + $commandInstance = $this->loadCommand($commandName); - // And validate it - if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) { - // This command has an invalid instance! - throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND); - } + // And validate it + if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) { + // This command has an invalid instance! + throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND); + } // END - if - // Set last command - $this->lastCommandInstance = $commandInstance; - } catch (MissingArrayElementsException $e) { - // Just catch it here... - } + // Set last command + $this->lastCommandInstance = $commandInstance; // Return the resolved command instance return $commandInstance;