private function getCompiledHelpCommand(IRequest $request) : ICommand
    {
        $helpCommand = new HelpCommand(new CommandFormatter(), new PaddingFormatter());
        $commandName = null;

        if ($request->getCommandName() === 'help') {
            $compiledHelpCommand = $this->commandCompiler->compile($helpCommand, $request);

            if ($compiledHelpCommand->argumentValueIsSet('command')) {
                $commandName = $compiledHelpCommand->getArgumentValue('command');
            }
        } else {
            $commandName = $request->getCommandName();
        }

        // Set the command only if it was passed as an argument to the help command
        if ($commandName !== null && $commandName !== '') {
            if (!$this->commandCollection->has($commandName)) {
                throw new InvalidArgumentException("No command with name \"$commandName\" exists");
            }

            $command = $this->commandCollection->get($commandName);
            $helpCommand->setCommand($command);
        }

        return $helpCommand;
    }
private function getCompiledHelpCommand(IRequest $request) : ICommand
    {
        $helpCommand = new HelpCommand(new CommandFormatter(), new PaddingFormatter());
        $commandName = null;

        if ($request->getCommandName() === 'help') {
            $compiledHelpCommand = $this->commandCompiler->compile($helpCommand, $request);

            if ($compiledHelpCommand->argumentValueIsSet('command')) {
                $commandName = $compiledHelpCommand->getArgumentValue('command');
            }
        } else {
            $commandName = $request->getCommandName();
        }

        // Set the command only if it was passed as an argument to the help command
        if ($commandName !== null && $commandName !== '') {
            if (!$this->commandCollection->has($commandName)) {
                throw new InvalidArgumentException("No command with name \"$commandName\" exists");
            }

            $command = $this->commandCollection->get($commandName);
            $helpCommand->setCommand($command);
        }

        return $helpCommand;
    }
private function getCompiledHelpCommand ( IRequest $ request ) : ICommand { $ helpCommand = new HelpCommand ( new CommandFormatter ( ) , new PaddingFormatter ( ) ) ; $ commandName = null ; if ( $ request -> getCommandName ( ) === 'help' ) { $ compiledHelpCommand = $ this -> commandCompiler -> compile ( $ helpCommand , $ request ) ; if ( $ compiledHelpCommand -> argumentValueIsSet ( 'command' ) ) { $ commandName = $ compiledHelpCommand -> getArgumentValue ( 'command' ) ; } } else { $ commandName = $ request -> getCommandName ( ) ; } // Set the command only if it was passed as an argument to the help command if ( $ commandName !== null && $ commandName !== '' ) { if ( ! $ this -> commandCollection -> has ( $ commandName ) ) { throw new InvalidArgumentException ( "No command with name \"$commandName\" exists" ) ; } $ command = $ this -> commandCollection -> get ( $ commandName ) ; $ helpCommand -> setCommand ( $ command ) ; } return $ helpCommand ; }
Gets the compiled help command

@param IRequest $request The parsed request
@return ICommand The compiled help command
@throws InvalidArgumentException Thrown if the command that is requesting help does not exist
Gets the compiled help command