X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Fresolver%2Fcommand%2Fconsole%2Fclass_ConsoleCommandResolver.php;fp=framework%2Fmain%2Fclasses%2Fresolver%2Fcommand%2Fconsole%2Fclass_ConsoleCommandResolver.php;h=7cd5109e78096b1e1d9b3bb5685b647005e4ff05;hb=d1d4c27a298fb48a433ab3ee132229d88274b060;hp=ae85aa7e3abad826a5b9daff9c6f6505feaaf6d8;hpb=1a5a49c27fafcab503f496cfae071374e6d739df;p=core.git diff --git a/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php b/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php index ae85aa7e..7cd5109e 100644 --- a/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php +++ b/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php @@ -49,20 +49,24 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol /** * Creates an instance of a Console command resolver with a given default command * + * @param $namespace Namespace of the command's class file * @param $commandName The default command we shall execute * @return $resolverInstance The prepared command resolver instance * @throws InvalidArgumentException Thrown if default command is not set * @throws InvalidCommandException Thrown if default command is invalid */ - public static final function createConsoleCommandResolver ($commandName) { + public static final function createConsoleCommandResolver ($namespace, $commandName) { // Create the new instance $resolverInstance = new ConsoleCommandResolver(); // Is the variable $commandName set and the command is valid? - if (empty($commandName)) { + if (empty($namespace)) { + // Then thrown an exception here + throw new InvalidArgumentException('Parameter "namespace" is empty'); + } elseif (empty($commandName)) { // Then thrown an exception here throw new InvalidArgumentException('Parameter "commandName" is empty'); - } elseif ($resolverInstance->isCommandValid($commandName) === false) { + } elseif (!$resolverInstance->isCommandValid($namespace, $commandName)) { // Invalid command found throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND); }