Runs the current application.

@param InputInterface  $input  An Input instance
@param OutputInterface $output An Output instance

@return int 0 if everything went fine, or an error code
514558
public function doRun(InputInterface $input, OutputInterface $output)
    {
        if (!$input->hasParameterOption('--quiet')) {
            $output->write(
                sprintf(
                    "phpjunitmerge %s by Andreas Weber\n\n",
                    $this->getVersion()
                )
            );
        }

        if ($input->hasParameterOption('--version')
            || $input->hasParameterOption('-V')
        ) {
            exit;
        }

        if (!$input->getFirstArgument()) {
            $input = new ArrayInput(array('--help'));
        }

        parent::doRun($input, $output);
    }
141558
protected function execute(InputInterface $input, OutputInterface $output): ?int
    {
        $username = $this->getUsername($input, $output);
        if ($input->getOption('if-not-exists')) {
            try {
                $user = $this->userManager->loadUserByUsername($username);
            } catch (\Exception $e) {
                $user = null;
            }
            if ($user) {
                $message = $this->translator->trans(
                    'user.already_exists',
                    [
                        '%username%' => $username,
                    ],
                    'security'
                );
                $output->writeln("<comment>{$message}</comment>");

                return 0;
            }
        }

        try {
            $user = $this->userManager->createUser($username);
        } catch (BadUsernameException $e) {
            $output->writeln("<error>{$e->getMessage()}</error>");

            return 1;
        }

        $user->setSuperAdmin($input->getOption('admin'));
        $password = $this->getPassword($input, $output);
        if ($password) {
            $this->userManager->setPlainTextPassword($user, $password);
        }
        $this->userManager->save($user);

        $message = $this->translator->trans('user.created_success', ['%username%' => $username], 'security');
        $output->writeln("<info>{$message}</info>");

        return 0;
    }
22261
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $success = $this->_queue->runNextJob();
        if ($success === true) {
            $output->writeln("Queue Processed.");
        } elseif ($success === false) {
            $output->writeln("Job failed.");
        } else {
            $output->writeln("No jobs in queue.");
        }
    }
660074
protected function runCommand(InputInterface $input, OutputInterface $output)
    {
        $appName = $input->getArgument('app-name');
        $this
            ->repositoryBucket->findRepository($appName)
            ->deleteTokens();
    }
546576
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln(GeneralUtility::makeInstance(KauderwelschService::class)->getLoremIpsum());
        return 0;
    }
1151786
protected function execute(InputInterface $input, OutputInterface $output)
    {
        try
        {
            if (method_exists($this, 'start'))
            {
                $this->start();
            }
            else
            {
                throw new \RuntimeException('Command is not set correctly.');
            }
        }
        catch (\Exception $e)
        {
            $this->error($e->getMessage());
        }
    }
1242561
protected function runCommand(InputInterface $input, OutputInterface $output)
    {
        $appName = $input->getArgument('app-name');
        $indices = $this
            ->repositoryBucket
            ->findRepository($appName)
            ->getIndices();

        self::printIndices(
            $input,
            $output,
            $indices
        );
    }
1146319
public function doRun(InputInterface $input, OutputInterface $output)
    {
        $this->registerCommands();
        if (true === $input->hasParameterOption(array('--shell', '-s'))) {
            $shell = new Shell($this);
            $shell->setProcessIsolation($input->hasParameterOption(array('--process-isolation')));
            $shell->run();

            return 0;
        }

        return parent::doRun($input, $output);
    }
459494
public function run(Input $input, Output $output) {
        $this->input = $input;
        $this->output = $output;

        $this->getSynopsis(true);
        $this->getSynopsis(false);

        $this->mergeConsoleDefinition();

        try {
            $input->bind($this->definition);
        }
        catch (\Exception $e) {
            if (!$this->ignoreValidationErrors) {
                throw $e;
            }
        }

        $this->initialize($input, $output, $this);

        if ($input->isInteractive()) {
            $this->interact($input, $output, $this);
        }

        $input->validate();

        if ($this->code) {
            $statusCode = call_user_func($this->code, $input, $output);
        }
        else {
            $statusCode = $this->execute($input, $output, $this);
        }

        return is_numeric($statusCode) ? (int)$statusCode : 0;
    }
1225865
public function doRun(InputInterface $input, OutputInterface $output)
    {

        $ioFactory = ConsoleIOFactory::buildDefault($input, $output, $this->getHelperSet());
        $this->io = $ioFactory->get();

        return parent::doRun($input, $output);
    }
347975
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->setInputAndOutput($input, $output);

        return $this->doExecute();
    }
821227
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = new SymfonyOutput($output);

        $this->input = $input;

        if (method_exists($this, 'handle')) {
            $this->handle();
        }
    }
513689
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $dryRun = $input->getOption('dry-run');
        $skipErrors = $input->getOption('skip-errors');
        $batchSize = NumberUtils::bound($input->getOption('batch-size'), 1, 1000);
        $batchDelay = NumberUtils::bound($input->getOption('batch-delay'), 100, 600000);
        $since = $input->getOption('since');
        $until = $input->getOption('until');
        $context = json_decode($input->getOption('context') ?: '{}', true);
        $context['tenant_id'] = (string)$input->getOption('tenant-id');
        $context['skip_errors'] = $skipErrors;
        $streamId = $input->getArgument('stream-id') ? StreamId::fromString($input->getArgument('stream-id')) : null;

        if (!empty($since)) {
            $since = Microtime::fromString(str_pad($since, 16, '0'));
        }

        if (!empty($until)) {
            $until = Microtime::fromString(str_pad($until, 16, '0'));
        }

        $io = new SymfonyStyle($input, $output);
        $io->title(sprintf('Replaying events from stream "%s"', $streamId ?? 'ALL'));
        $this->useInMemoryTransports($input, $io);
        if (!$this->readyForPbjxTraffic($io)) {
            return;
        }

        $this->createConsoleRequest();
        $pbjx = $this->getPbjx();
        $batch = 1;
        $i = 0;
        $replayed = 0;
        $io->comment(sprintf('Processing batch %d from stream "%s".', $batch, $streamId ?? 'ALL'));
        $io->comment(sprintf('context: %s', json_encode($context)));
        $io->newLine();

        $receiver = function (Event $event, StreamId $streamId) use (
            $output,
            $io,
            $pbjx,
            $dryRun,
            $skipErrors,
            $batchSize,
            $batchDelay,
            &$batch,
            &$replayed,
            &$i
        ) {
            ++$i;

            try {
                $output->writeln(
                    sprintf(
                        '<info>%d.</info> <comment>stream:</comment>%s, <comment>occurred_at:</comment>%s, ' .
                        '<comment>curie:</comment>%s, <comment>event_id:</comment>%s',
                        $i,
                        $streamId,
                        $event->get('occurred_at'),
                        $event::schema()->getCurie()->toString(),
                        $event->get('event_id')
                    )
                );

                if ($dryRun) {
                    $io->note(sprintf('DRY RUN - Would publish event "%s" here.', $event->get('event_id')));
                } else {
                    $event->isReplay(true);
                    $pbjx->publish($event);
                }

                ++$replayed;
            } catch (\Throwable $e) {
                $io->error(sprintf('%d. %s', $i, $e->getMessage()));
                $io->note(sprintf('%d. Failed event "%s" json below:', $i, $event->get('event_id')));
                $io->text(json_encode($event, JSON_PRETTY_PRINT));
                $io->newLine(2);

                if (!$skipErrors) {
                    throw $e;
                }
            }

            if (0 === $i % $batchSize) {
                ++$batch;

                if ($batchDelay > 0) {
                    $io->newLine();
                    $io->note(sprintf('Pausing for %d milliseconds.', $batchDelay));
                    usleep($batchDelay * 1000);
                }

                $io->comment(sprintf('Processing batch %d.', $batch));
                $io->newLine();
            }
        };

        if ($streamId) {
            $this->getPbjx()->getEventStore()->pipeEvents($streamId, $receiver, $since, $until, $context);
        } else {
            $this->getPbjx()->getEventStore()->pipeAllEvents($receiver, $since, $until, $context);
        }

        $io->newLine();
        $io->success(sprintf('Replayed %s events from stream "%s".', number_format($replayed), $streamId ?? 'ALL'));
    }
850737
protected function execute(InputInterface $input, OutputInterface $output)
    {
        return $this->getRunner($input, $output)->run() ? 0 : -1;
    }
543964
public function doRun(InputInterface $input, OutputInterface $output) : int
    {
        $output->setDecorated(false);
        $input->setInteractive(false);

        $command = $this->createCommand();
        return $command->run($input, $output);
    }
940065
public function run(InputInterface $input, OutputInterface $output)
    {
        $this->setInput($input);
        $this->setOutput($output);

        return parent::run($input, $output);
    }
918941
private function runInternal(InputInterface $input, OutputInterface $output)
    {
        try {
            $this->exporter->execute();
        } catch (Exception $e) {
            $output->writeln("Aborting: " . $e->getMessage());

            return 1;
        }

        return 0;
    }