Executes the business logic involved with this command.

@param InputInterface  $input
@param OutputInterface $output

@throws \Exception if the provided source is not an existing file or a folder.

@return int
966996
protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var ConfigurationHelper $configurationHelper */
        $configurationHelper = $this->getHelper('phpdocumentor_configuration');

        $progress = $this->getProgressBar($input);
        if (! $progress) {
            $this->connectOutputToEvents($output);
        }

        // initialize transformer
        $transformer = $this->getTransformer();

        $target = (string) $configurationHelper->getOption($input, 'target', 'transformer/target');
        $fileSystem = new Filesystem();
        if (! $fileSystem->isAbsolutePath($target)) {
            $target = getcwd() . DIRECTORY_SEPARATOR . $target;
        }
        $transformer->setTarget($target);

        $source = realpath($configurationHelper->getOption($input, 'source', 'parser/target'));
        if (!file_exists($source) || !is_dir($source)) {
            throw new \Exception('Invalid source location provided, a path to an existing folder was expected');
        }

        $this->getCache()->getOptions()->setCacheDir($source);

        $projectDescriptor = $this->getBuilder()->getProjectDescriptor();
        $mapper = new ProjectDescriptorMapper($this->getCache());
        $output->writeTimedLog('Load cache', array($mapper, 'populate'), array($projectDescriptor));

        foreach ($this->getTemplates($input) as $template) {
            $output->writeTimedLog(
                'Preparing template "'. $template .'"',
                array($transformer->getTemplates(), 'load'),
                array($template, $transformer)
            );
        }
        $output->writeTimedLog(
            'Preparing ' . count($transformer->getTemplates()->getTransformations()) . ' transformations',
            array($this, 'loadTransformations'),
            array($transformer)
        );

        if ($progress) {
            $progress->start($output, count($transformer->getTemplates()->getTransformations()));
        }

        /** @var CompilerPassInterface $pass */
        foreach ($this->compiler as $pass) {
            $output->writeTimedLog($pass->getDescription(), array($pass, 'execute'), array($projectDescriptor));
        }

        if ($progress) {
            $progress->finish();
        }

        return 0;
    }
35145
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $directory = (string) $input->getArgument('directory');
        $overwriteDefaultLpvFile = $input->getOption('overwrite');

        if ($directory !== WORKING_DIRECTORY) {
            try {
                $this->analyser->setDirectory($directory);
            } catch (\RuntimeException $e) {
                $warning = "Warning: The provided directory "
                    . "'$directory' does not exist or is not a directory.";
                $outputContent = '<error>' . $warning . '</error>';
                $output->writeln($outputContent);

                return 1;
            }
        }

        $defaultLpvFile = WORKING_DIRECTORY . DIRECTORY_SEPARATOR . '.lpv';

        if (file_exists($defaultLpvFile) && $overwriteDefaultLpvFile === false) {
            $warning = 'Warning: A default .lpv file already exists.';
            $outputContent = '<error>' . $warning . '</error>';
            $output->writeln($outputContent);

            return 1;
        }

        $defaultGlobPatterns = $this->analyser->getDefaultGlobPatterns();
        $lpvFileContent = implode("\n", $defaultGlobPatterns);

        $bytesWritten = file_put_contents(
            $defaultLpvFile,
            $lpvFileContent
        );

        if ($bytesWritten === false) {
            $warning = 'Warning: The creation of the default .lpv file failed.';
            $outputContent = '<error>' . $warning . '</error>';
            $output->writeln($outputContent);

            return 1;
        }

        $info = "<info>Created default '$defaultLpvFile' file.</info>";
        $output->writeln($info);

        return 0;
    }
234391
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $pipeLine = $this->pipeline;
        $pipeLine($input->getOptions());

        return 0;
    }
608343
public function execute(InputInterface $input, OutputInterface $output)
    {
        if (empty($path = $input->getArgument('path'))) {
            $this->render($input, $output);
        } else {
            $this->test($input->getArgument('method'), $path, $input, $output);
        }

        return 0;
    }
739175
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->validateCommand($input);

        $output->writeln('> Loading configuration file');
        $config = $input->getOption('config');
        $files = (new ConfigResolver())->getFileList($config);
        $output->writeLn('- Found '.count($files).' files');

        $preloader = (new Factory())->create($this->getOptions($input));

        $outputFile = $input->getOption('output');
        $handle = $preloader->prepareOutput($outputFile, $input->getOption('strict_types'));

        $output->writeln('> Compiling classes');

        $count = 0;
        $countSkipped = 0;
        $comments = !$input->getOption('strip_comments');

        foreach ($files as $file) {
            $count++;

            try {
                $code = $preloader->getCode($file, $comments);
                $output->writeln('- Writing '.$file);
                fwrite($handle, $code."\n");
            } catch (VisitorExceptionInterface $e) {
                $countSkipped++;
                $output->writeln('- Skipping '.$file);
            }
        }

        fclose($handle);

        $output->writeln("> Compiled loader written to $outputFile");
        $output->writeln('- Files: '.($count - $countSkipped).'/'.$count.' (skipped: '.$countSkipped.')');
        $output->writeln('- Filesize: '.(round(filesize($outputFile) / 1024)).' kb');
    }
543964
public function doRun(InputInterface $input, OutputInterface $output) : int
    {
        $output->setDecorated(false);
        $input->setInteractive(false);

        $command = $this->createCommand();
        return $command->run($input, $output);
    }
143454
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $filename = $input->getArgument('filename');
        $key = $input->getArgument('key');
        $value = $input->getArgument('value');
        $yaml_parsed = $this->loadYamlFile($filename);
        if ($yaml_parsed === false) {
            // Exit with a status of 1.
            return 1;
        }

        $data = new Data($yaml_parsed);
        $data->set($key, $value);

        if ($this->writeYamlFile($filename, $data)) {
            $this->output->writeln("<info>The value for key '$key' was set to '$value' in $filename.</info>");
        }
    }
557886
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;

        if (null === ($backupDir = $input->getArgument('backup-dir'))) {
            $backupDir = $this->doAskBackupDir();
        }

        if (null === ($machine = $input->getOption('machine'))) {
            $machine = $this->doAskMachineName();
        }

        if (null === ($installDir = $input->getOption('install-dir'))) {
            $installDir = $this->doAskInstallDir();
        }

        $this->initDotfilesProfile($backupDir, $machine, $installDir);
    }
579477
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->input  = $input;
        $this->output = $output;
        $this->io     = new SymfonyStyle($this->input, $this->output);

        return $this->go();
    }
330292
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $setting = $input->getOption('setting');
        $options = array();

        if ($setting === null) {
            throw new \Exception('No setting provided!');
        }

        $scan = new \Psecio\Iniscan\Scan();
        $ruleSet = $scan->getRules();

        // see if we can find info about the setting
        $found = array();
        foreach ($ruleSet as $section => $rules) {
            foreach ($rules as $rule) {
                if (isset($rule->test->key) && $rule->test->key === $setting) {
                    if (isset($rule->info)) {
                        $found[] = $rule;
                    }
                }
            }
        }

        if (!empty($found)) {
            $outputHandler = new \Psecio\Iniscan\Command\InfoCommand\Output\Console($output, $options);
            return $outputHandler->render($found);
        } else {
            $output->writeLn('No information found for setting '.$setting);
        }
    }
11912
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $builder = $this->getMenuBuilder($input, $output);
        if ($input->getOption('dump')) {
            $this->dumpCommands($builder, $output);
        } else {
            $builder->build()->open();
        }
        return 0;
    }
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);
    }
305470
public function execute(InputInterface $input, OutputInterface $output)
    {
        $host = $input->getArgument('host');
        $ip = $input->getArgument('ip');

        $this->hostFile->add($host, $ip);

        $output->writeLn("\"$ip $host\" was added to file.");
    }
376279
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $name = $input->getArgument('name');

        $cpath = app_path().'/controllers/';
        $filename = $name.'.php';
        $filepath = $cpath.$filename;

        if (file_exists($filepath)) {
            unlink($filepath);
            $output->writeln("<info>Controller: $name was deleted</info>");

            shell_exec('composer dump-autoload -o');
        } else {
            $output->writeln("<error>Controller: $name doesn't exists!");
        }
    }
260941
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
        $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
        $errOutput->setVerbosity(OutputInterface::VERBOSITY_NORMAL);

        $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');
        $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'));
        }

        $i = 0;
        $receiver = function (Event $event, StreamId $streamId) use ($errOutput, $batchSize, $batchDelay, &$i) {
            ++$i;

            try {
                echo json_encode($event) . PHP_EOL;
            } catch (\Throwable $e) {
                $errOutput->writeln($e->getMessage());
            }

            if (0 === $i % $batchSize) {
                if ($batchDelay > 0) {
                    usleep($batchDelay * 1000);
                }
            }
        };

        if ($streamId) {
            $this->getPbjx()->getEventStore()->pipeEvents($streamId, $receiver, $since, $until, $context);
        } else {
            $this->getPbjx()->getEventStore()->pipeAllEvents($receiver, $since, $until, $context);
        }
    }
310074
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->injectOutputIntoLogger($output, $this->logger);
        $adapter = $this->databaseImportExportAdapterManager->getAdapter($input->getOption('adapter'));
        $adapter->setLogger($this->logger);

        $database = $input->getArgument('database');
        $filename = $input->getArgument('filename');

        $this->logger->info("Importing \"$filename\" into database \"$database\".");
        $adapter->importFromFile(
            $filename,
            $database,
            [] // This command does not yet support any options
        );
        $this->logger->info("\"$filename\" imported into database \"$database\".");
        return 0;
    }
503861
public function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        try {
            $this->doExecute($input, $output);
        } catch (\Exception $e) {
            $this->writeException($e);
        }
    }