Liuggio\Fastest\Command\ParallelCommand::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)
    {
        $stopWatch = new Stopwatch();
        $stopWatch->start('execute');
        // init
        $queueFactory = new InMemoryQueueFactory();
        $readFromInputAndPushIntoTheQueue = new ReadFromInputAndPushIntoTheQueue($queueFactory);
        $queue = $readFromInputAndPushIntoTheQueue->execute($input->getOption('xml'), $input->getOption('preserve-order'));
        $maxNumberOfParallelProc = $this->getMaxNumberOfProcess($input->getOption('process'));
        $processFactory = new ProcessFactory($maxNumberOfParallelProc, $input->getArgument('execute'));
        $processManager = new ProcessesManager($processFactory, $maxNumberOfParallelProc, $input->getOption('before'));
        // header
        $shuffled = $input->getOption('preserve-order') ? '' : 'shuffled ';
        $output->writeln('- <fg=white;bg=blue>' . $queue->count() . '</> ' . $shuffled . 'test classes into the queue.');
        $output->writeln('- Will be consumed by <fg=white;bg=blue>' . $maxNumberOfParallelProc . '</> parallel Processes.');
        // loop
        $processes = $this->doExecute($input, $output, $queue, $processManager);
        $event = $stopWatch->stop('execute');
        $output->writeln(sprintf("    Time: %d ms, Memory: %d b", $event->getDuration(), $event->getMemory()));
        if ($input->getOption('rerun-failed')) {
            $processes = $this->executeBeforeCommand($queue, $processes, $input, $output, $processManager);
        }
        return $processes->getExitCode();
    }