prepare exec of command "scan"

@param InputInterface $input

@throws \Exception
968704
public function prepareExecute(InputInterface $input)
    {
        $this->coverFishHelper = new CoverFishHelper();

        $phpUnitConfigFile = $input->getArgument('phpunit-config');
        if (false === empty($phpUnitConfigFile) &&
            false === $this->coverFishHelper->checkFileOrPath($phpUnitConfigFile)) {
            throw new \Exception(sprintf('phpunit config file "%s" not found! please define your phpunit.xml config file to use (e.g. tests/phpunit.xml)', $phpUnitConfigFile));
        }

        $testPathOrFile = $input->getOption('raw-scan-path');
        if (false === empty($testPathOrFile) &&
            false === $this->coverFishHelper->checkFileOrPath($testPathOrFile)) {
            throw new \Exception(sprintf('test path/file "%s" not found! please define test file path (e.g. tests/)', $testPathOrFile));
        }
    }
922936
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $inputFile = $input->getArgument('input-file');
        $outputFile = $input->getArgument('output-file');

        if ($outputFile === null) {
            $outputFile = preg_replace('/\\.[^.]*$/', '.php', $inputFile);
        }

        $parserGenerator = new ParserGenerator(new PegFile());

        $output = "<?php\n\n" . $parserGenerator->createClass($inputFile);

        file_put_contents($outputFile, $output);
    }
495302
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $logger = $this->getLogger();

        if (!$this->lock()) {
            $output->writeln('<comment>The command is already running in another process.</comment>');
            $logger->warning('Command is already running.');
        } else {
            try {
                $logger->info('Started export in command.');

                $orderVisitor = $this->getOrders();

                $this->getExporter()->exportOrders($orderVisitor, $this->getProgressBar($output, count($orderVisitor)));

                $logger->info('Finished export in command.');
            } catch (Exception $exc) {
                $logger->error('Stopped export in command.', ['exception' => $exc]);
            }
        }
    }
893976
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Available templates:');
        foreach ($this->factory->getAllNames() as $template_name) {
            $output->writeln('* '.$template_name);
        }
        $output->writeln('');
    }
491684
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $method = $this->method;
        $this->setHelperSet($this->getApplication()->getHelperSet());
        if ($this->argument != null) {
            $argument = $input->getArgument($this->argument);
            $this->$method($argument);

            return;
        }

        $this->$method($input,$output);
    }
1025320
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output);
        $plugins = $this
            ->pluginManager
            ->loadPlugins();

        foreach ($plugins as $plugin) {
            $this->printMessage(
                $output,
                'Plugin',
                'Plugin "' . $plugin->getNamespace() . '" installed'
            );
        }

        $this->finishCommand($output);
    }
1216702
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->setupConsole($input, $output);
        $this->serve();
    }
174037
protected function execute(InputInterface $input, OutputInterface $output) : void
    {
        $io     = $this->getIO($input, $output);
        $config = $this->getConfig($input->getOption('configuration'), true);
        $repo   = new Repository();
        $args   = new Config\Options(['file' => $input->getOption('message')]);
        $name   = $input->getArgument('hook');
        $class  = '\\CaptainHook\\App\\Runner\\Hook\\' . Util::getHookCommand($name);

        /** @var \CaptainHook\App\Runner\Hook $hook */
        $hook = new $class($io, $config, $repo, $args);
        $hook->run();
    }
1177449
protected function execute(InputInterface $input, OutputInterface $output)
  {
    $this->_input = $input;
    $this->_output = $output;

    $params = array_values($input->getArguments());
    //Strip off the command name
    array_shift($params);

    //Call the execute command with $input and $output as the first args
    if(method_exists($this, 'executeCommand'))
    {
      array_unshift($params, $input, $output);
      return $this->executeCommand(...$params);
    }

    //Call the process method, without $input and $output
    if(method_exists($this, 'process'))
    {
      return $this->process(...$params);
    }

    throw new \RuntimeException(
      "Your command must contain one of the following methods:\n" .
      "process()\n" .
      'executeCommand(InputInterface $input, OutputInterface $output)' . "\n",
      500
    );
  }
703469
protected function processOptions(InputInterface $input, OutputInterface $output): void
    {
        $exclude = TypeCast::castString($input->getOption('exclude'));
        $format = $input->getOption('format');
        $this->format = is_string($format) ? $format : null;
        $basePath = $input->getOption('directory');
        $this->basePath = is_string($basePath) ? $basePath : './';

        // Add slash to the path
        if (substr($this->basePath, -1) !== '/') {
            $this->basePath .= '/';
        }

        $this->verbose = $output->isVerbose();
        $this->output = $output;
        $this->skipClasses = (bool)$input->getOption('skip-classes');
        $this->skipMethods = (bool)$input->getOption('skip-methods');
        $this->skipSignatures = (bool)$input->getOption('skip-signatures');

        // Set up excludes:
        if (!empty($exclude)) {
            $this->exclude = array_map('trim', explode(',', $exclude));
        }
    }
721841
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $templateName = $input->getArgument('template');
        $templates = $this->configurationManager->get('store.templates');
        $templateFound = array_reduce(
            $templates,
            function ($alreadyFound, $template) use ($templateName) {
                return $alreadyFound || ($template['bundle'] == $templateName);
            },
            false);

        if (!$templateFound) {
            throw new Exception(sprintf('Template %s not found', $templateName));
        }

        $this
            ->configurationManager
            ->set('store.template', $templateName);

        $formatter = $this->getHelper('formatter');
        $formattedLine = $formatter->formatSection(
            'OK',
            'Template "' . $templateName . '" enabled'
        );

        $output->writeln($formattedLine);
    }
53704
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->before($input, $output);
        $this->runTransient($input, $output);
        $this->after($input, $output);
    }
1004433
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, 2000);
        $batchDelay = NumberUtils::bound($input->getOption('batch-delay'), 10, 600000);
        $context = json_decode($input->getOption('context') ?: '{}', true);
        $context['tenant_id'] = (string)$input->getOption('tenant-id');
        $context['skip_errors'] = $skipErrors;
        $context['reindexing'] = true;
        $qname = $input->getArgument('qname') ? SchemaQName::fromString($input->getArgument('qname')) : null;
        $context['reindex_all'] = null === $qname;

        $io = new SymfonyStyle($input, $output);
        $io->title(sprintf('Reindexing nodes for qname "%s"', $qname ?? 'ALL'));
        if (!$this->readyForNcrTraffic($io)) {
            return;
        }

        $batch = 1;
        $i = 0;
        $reindexed = 0;
        $queue = [];
        //$io->comment(sprintf('Processing batch %d for qname "%s".', $batch, $qname ?? 'ALL'));
        $io->comment(sprintf('context: %s', json_encode($context)));
        $io->newLine();

        $receiver = function (Node $node) use (
            $output,
            $io,
            $context,
            $dryRun,
            $skipErrors,
            $batchSize,
            $batchDelay,
            &$batch,
            &$reindexed,
            &$i,
            &$queue
        ) {
            if (!$node instanceof Indexed) {
                $io->note(sprintf(
                    'IGNORING - Node [%s] does not have mixin [gdbots:ncr:mixin:indexed].',
                    NodeRef::fromNode($node)
                ));
                return;
            }

            ++$i;
            $output->writeln(
                sprintf(
                    '<info>%d.</info> <comment>node_ref:</comment>%s, <comment>status:</comment>%s, ' .
                    '<comment>etag:</comment>%s, <comment>title:</comment>%s',
                    $i,
                    NodeRef::fromNode($node),
                    $node->get('status'),
                    $node->get('etag'),
                    $node->get('title')
                )
            );
            $queue[] = $node->freeze();

            if (count($queue) >= $batchSize) {
                $nodes = $queue;
                $queue = [];
                $this->reindex($nodes, $reindexed, $io, $context, $batch, $dryRun, $skipErrors);
                ++$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();
            }
        };

        foreach ($this->getSchemasUsingMixin(IndexedV1Mixin::create(), (string)$qname ?: null) as $schema) {
            $this->ncr->pipeNodes($schema->getQName(), $receiver, $context);
        }

        $this->reindex($queue, $reindexed, $io, $context, $batch, $dryRun, $skipErrors);
        $io->newLine();
        $io->success(sprintf('Reindexed %s nodes for qname "%s".', number_format($reindexed), $qname ?? 'ALL'));
    }
513771
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $seed = $input->getArgument('seed');

        $seedPath = base_path().'/database/seeds';
        $file = $seedPath.'/'.$seed.'.php';

        if (file_exists($file)) {
            require_once $file;
            $class = '\\'.$seed;
            $c = new $class();
            $c->run();
        } else {
            $output->writeln("<error>$seed seed does not exist!</error>");
        }
    }
391571
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);

        $info = $this
            ->getSession()
            ->getInspector()
            ->getSchemaRelations($this->fetchSchemaOid()
        );
        $this->formatOutput($output, $info);
    }
419662
public function execute(InputInterface $input, OutputInterface $output)
    {
        $argument = $input->getArgument($this->argumentName);
        $path = $this->basePath.'/'.$argument.'.php';

        if ($input->hasOption('restful') && $input->getOption('restful') == true) {
            $this->restful = true;
        } else {
            $this->restful = false;
        }

        $response = $this->runFileGeneratorCommand($path, $argument);

        if ($response === true) {
            $this->type ?: $this->type = 'Command';
            $output->writeln(ucfirst($this->type).' created successfully');

            return;
        }
        $output->writeln($response);
    }
346671
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path       = $input->getArgument(self::COMMAND_NAME);
        $realPath   = realpath($path);
        $configFile = $input->getOption('config');

        $finder = new FileParser($configFile);

        if (file_exists($configFile)) {
            $this->scanFiles($path, $finder);

            if (!empty($this->errors)) {
                $output->writeln("<info>To-do expressions were found:</info>\n");
                foreach ($this->errors as $file => $lines) {
                    foreach ($lines as $line) {
                        $output->writeln(
                            sprintf(
                                "<comment> - .%s:</comment> %s",
                                str_replace($realPath, '', $file),
                                $line
                            )
                        );
                    }
                }

                if (count($this->flatten($this->errors)) > $finder->getTotalAllowed()) {
                    throw new \Exception('To-do statements are piling up! Isn\'t it time to address this issue?');
                }
            }

            return $output->writeln("<info>\nCongratulations! To-do statements are under control.\n</info>");
        }

        throw new ConfigFileException($configFile);
    }