src/Rocketeer/Services/Builders/Modules/CommandsBuilder.php
public function buildCommand($task, $slug = null)
    {
        // Build the task instance
        try {
            $instance = $this->modulable->buildTask($task);
        } catch (TaskCompositionException $exception) {
            $instance = null;
        }

        // Get the command name
        $name = $instance ? $instance->getName() : null;
        $command = $this->modulable->findQualifiedName($name, 'commands');

        // If no command found, use BaseTaskCommand or task name
        if ($command === BaseTaskCommand::class) {
            $name = is_string($task) ? $task : $name;
            $command = $this->modulable->findQualifiedName($name, 'commands');
        }

        /** @var AbstractCommand $command */
        $command = new $command($instance, $slug);
        $command->setContainer($this->container);

        return $command;
    }
public function buildCommand($task, $slug = null)
    {
        // Build the task instance
        try {
            $instance = $this->modulable->buildTask($task);
        } catch (TaskCompositionException $exception) {
            $instance = null;
        }

        // Get the command name
        $name = $instance ? $instance->getName() : null;
        $command = $this->modulable->findQualifiedName($name, 'commands');

        // If no command found, use BaseTaskCommand or task name
        if ($command === BaseTaskCommand::class) {
            $name = is_string($task) ? $task : $name;
            $command = $this->modulable->findQualifiedName($name, 'commands');
        }

        /** @var AbstractCommand $command */
        $command = new $command($instance, $slug);
        $command->setContainer($this->container);

        return $command;
    }
public function buildCommand ( $ task , $ slug = null ) { // Build the task instance try { $ instance = $ this -> modulable -> buildTask ( $ task ) ; } catch ( TaskCompositionException $ exception ) { $ instance = null ; } // Get the command name $ name = $ instance ? $ instance -> getName ( ) : null ; $ command = $ this -> modulable -> findQualifiedName ( $ name , 'commands' ) ; // If no command found, use BaseTaskCommand or task name if ( $ command === BaseTaskCommand :: class ) { $ name = is_string ( $ task ) ? $ task : $ name ; $ command = $ this -> modulable -> findQualifiedName ( $ name , 'commands' ) ; } /** @var AbstractCommand $command */ $ command = new $ command ( $ instance , $ slug ) ; $ command -> setContainer ( $ this -> container ) ; return $ command ; }
Build the command bound to a task.

@param string|\Rocketeer\Tasks\AbstractTask $task
@param string|null                          $slug

@return \Rocketeer\Console\Commands\AbstractCommand
Build the command bound to a task .