Rocketeer\Services\Tasks\TasksBuilder::buildCommand PHP Метод

buildCommand() публичный Метод

Build the command bound to a task.
public buildCommand ( string | Rocketeer\Abstracts\AbstractTask $task, string | null $slug = null ) : Rocketeer\Abstracts\AbstractCommand
$task string | Rocketeer\Abstracts\AbstractTask
$slug string | null
Результат Rocketeer\Abstracts\AbstractCommand
    public function buildCommand($task, $slug = null)
    {
        // Build the task instance
        try {
            $instance = $this->buildTask($task);
        } catch (TaskCompositionException $exception) {
            $instance = null;
        }
        // Get the command name
        $name = $instance ? $instance->getName() : null;
        $command = $this->findQualifiedName($name, ['Rocketeer\\Console\\Commands\\%sCommand']);
        // If no command found, use BaseTaskCommand or task name
        if (!$command || $command === 'Closure') {
            $name = is_string($task) ? $task : $name;
            $command = $this->findQualifiedName($name, ['Rocketeer\\Console\\Commands\\%sCommand', 'Rocketeer\\Console\\Commands\\BaseTaskCommand']);
        }
        $command = new $command($instance, $slug);
        $command->setLaravel($this->app);
        return $command;
    }