/**
* 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);
}