Contao\CoreBundle\Command\AutomatorCommand::getTaskFromInput PHP Method

getTaskFromInput() private method

Returns the task name from the argument list or via an interactive dialog.
private getTaskFromInput ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : string | null
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
return string | null
    private function getTaskFromInput(InputInterface $input, OutputInterface $output)
    {
        $commands = $this->getCommands();
        $task = $input->getArgument('task');
        if (null !== $task) {
            if (!in_array($task, $commands)) {
                throw new \InvalidArgumentException(sprintf('Invalid task "%s"', $task));
                // no full stop here
            }
            return $task;
        }
        $question = new ChoiceQuestion('Please select a task:', $commands, 0);
        $question->setMaxAttempts(1);
        /** @var QuestionHelper $helper */
        $helper = $this->getHelper('question');
        return $helper->ask($input, $output, $question);
    }