Retrieves the handler for a specified command

@param string $commandName

@return object

@throws MissingHandlerException
195813
public function getHandlerForCommand($commandName)
    {
        if (!isset($this->commandNameToHandlerMap[$commandName])) {
            throw MissingHandlerException::forCommand($commandName);
        }

        $serviceId = $this->commandNameToHandlerMap[$commandName];

        return $this->container->get($serviceId);
    }
366561
protected function getCommandClass($id)
    {
        if (isset($this->commands[$id])) {
            return $this->commands[$id];
        }

        throw new Exception(sprintf("command %s not found in %s", $id, get_called_class()));
    }
1127884
public function handle($actionName)
    {
        if (isset($this->handlers[$actionName])) {
            return $this->handlers[$actionName]->perform($this, $actionName);
        } else {
            return $this->getController()->handle($this, $actionName);
        }
    }
1075591
public function execute(Command $command)
    {
        $handler = $this->resolver->resolve($command);

        return $handler->handle($command);
    }
852481
public static function getCommand($command)
    {
        if (!is_string($command) || strlen($command) < 1) {
            throw new BadMethodCallException('Parameter command is not a valid string');
        }
        $instance = self::getInstance();
        
        if (!isset($instance->commands[$command])) {
            throw new BadMethodCallException('Command "' . $command . '" is not a registered command');
        }
        
        return $instance->commands[$command];
    }
1065258
protected function getCommand(string $name): CommandInterface
    {
        foreach ($this->commands as $command) {
            if ($command->getName() === $name) {
                return $command;
            }
        }

        throw new CommandNotFound($name);
    }
1272141
public function getCommand($commandAlias)
    {
        if (!array_key_exists($commandAlias, $this->commands)) {
            throw new CommandException(sprintf('The command "%s" is not registered', $commandAlias));
        }

        return $this->commands[$commandAlias];
    }
760060
public function fetchCommand($name)
    {
        $name = ucfirst($name);

        $file = null;
        $packageName = null;

        foreach ($this->defaultCommandsPaths as $package => $path) {
            $file_handler = new FileHandler($path);

            $file = $file_handler->getFile($name);
            if (false !== $file) {
                $packageName = $package;

                break;
            }
        }

        if (false === $file) {
            $this->error(
                sprintf(
                    'Unknown command: ` %1$s`. Does the file exists `%2$s/%1$s.php` ?'.PHP_EOL,
                    $name,
                    $this->defaultCommandsPaths
                )
            );
            $message = $this->ansiFormat(sprintf('php %s.php help', $this->managerName), Console::FG_YELLOW);
            $this->normal(sprintf('Type %s for usage.'.PHP_EOL, $message));
        }

        // commands are in the commands namespace
        /** @var $className BaseCommand */
        $className = ClassHelper::getFormatNamespace($packageName).'Console\Command\\'.$name;

        return new $className();
    }
605581
protected function getHandler(): AbstractHandler
    {
        if ($this->handler === null
            && (
                is_callable($this->handlerGetter) === false
                || !(($this->handler = ($this->handlerGetter)()) instanceof \SlaxWeb\Output\AbstractHandler)
            )
        ) {
            throw new Exception\MissingOutputHandlerException(
                "Output Manager does not have a valid Output Handler nor an "
                . "Output Handler getter set, or it provided an invalid Handler."
            );
        }
        return $this->handler;
    }
1084404
public function get($name)
    {
        if (!isset($this->commands[$name])) {
            throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
        }

        $command = $this->commands[$name];

        if ($this->wantHelps) {
            $this->wantHelps = false;

            $helpCommand = $this->get('help');
            $helpCommand->setCommand($command);

            return $helpCommand;
        }

        return $command;
    }
838728
public function getHandler($handlerName)
    {
        $prefix = SmartboxIntegrationFrameworkExtension::HANDLER_PREFIX.$handlerName;

        return $this->container->get($prefix);
    }
470055
public static function executeCommand($commandName, array $commandParameters) {
        if (isset(self::$commands[$commandName])) {
            $commandAction = self::$commands[$commandName];
        }
        else {
            $commandsBaseNamespace = get_property("cli.commands_base_namespace");
            if (!empty($commandsBaseNamespace)) {
                $commandAction = $commandsBaseNamespace;
                $commandTokens = explode(".", $commandName);
                $commandTokensSize = sizeof($commandTokens);
                if ($commandTokensSize > 1) {
                    for ($i = 0; $i < $commandTokensSize - 1; $i++) {
                        $commandToken = $commandTokens[$i];
                        $commandAction .= '\\';
                        $commandAction .= str_replace(' ', '', ucwords(str_replace('_', ' ', $commandToken)));
                    }
                }
                $commandAction .= '\\';
                $commandAction .= str_replace(' ', '', ucwords(str_replace('_', ' ', $commandTokens[$commandTokensSize - 1])));
                $commandAction .= get_property("cli.commands_suffix", "Command");
            }
            else {
                throw new CommandNotFoundException("Command \"$commandName\" not found !!");
            }
        }

        $result = null;
        if (is_string($commandAction) && class_exists($commandAction) && is_subclass_of($commandAction, Command::class)) {
            if (!isset(self::$commandInstances[$commandAction])) {
                self::$commandInstances[$commandAction] = new $commandAction;
            }
            self::$commandInstances[$commandAction]->handle($commandParameters);
        }
        else  {
            try {
                get_app()->execute($commandAction, $commandParameters);
            }
            catch (ActionNotFoundException $ex) {
                throw new CommandNotFoundException("Command \"$commandName\" not found !!. Command class \"$commandAction\" not found !! ", 0, $ex);
            }
        }
        return $result;
    }
424137
public static function tooManyCommandHandler(AbstractCommand $command, array $commandHandlers)
    {
        $handlerClassNames = array_map(
            function (CommandHandlerInterface $commandHandler) {
                return get_class($commandHandler);
            },
            $commandHandlers
        );

        return new self(
            sprintf(
                'There are too many command handler for the command type %s. Candidates are %s.',
                get_class($command),
                implode(', ', $handlerClassNames)
            )
        );
    }
490203
public function getCommand($name, array $args = array()) {
    /*if($name != 'oauth') {
		  $this->checkAuth();
    }*/

    $command = parent::getCommand($name, $args);
    $this->command_history[] = $command;
		return $command;
	}
536814
public function get(string $name) : ICommand
    {
        if (!$this->has($name)) {
            throw new InvalidArgumentException("No command with name \"$name\" exists");
        }

        return $this->commands[$name];
    }
1238818
public function getCommand($command): Command
    {
        if (isset($this->aliases[$command])) {
            return $this->aliases[$command];
        }

        if (isset($this->commands[$command])) {
            return $this->commands[$command];
        }

        throw new CommandNotFoundException($this, $command);
    }
1237859
public static function commandHandlerAlreadyDefinedForCommand(
        $commandClassName,
        CommandHandlerInterface $previous,
        CommandHandlerInterface $current
    ) {
        $message = 'Trying to add handler %3$s handling command %1$s which is already handled by %2$s.';
        if (get_class($previous) === get_class($current)) {
            $message = 'Trying to add multiple handling method for the command %1$s in the handler %2$s';
        }

        return new self(sprintf($message, $commandClassName, get_class($previous), get_class($current)));
    }