Certificationy\Cli\Command\StartCommand::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $config = $this->path($input->getOption('config'));
        if ($input->getOption('list')) {
            $output->writeln(Loader::getCategories($config));
            return;
        }
        $categories = $input->getArgument('categories');
        $number = $input->getOption('number');
        $set = Loader::init($number, $categories, $config);
        if ($set->getQuestions()) {
            $output->writeln(sprintf('Starting a new set of <info>%s</info> questions (available questions: <info>%s</info>)', count($set->getQuestions()), Loader::count(array(), $this->path())));
            $this->askQuestions($set, $input, $output);
            $this->displayResults($set, $output);
        } else {
            $output->writeln('<error>✗</error> No questions can be found.');
        }
    }