@param InputInterface  $input
@param OutputInterface $output

@return int|null
@throws Exceptions\ConfigFileException
@throws \Exception
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);
    }
786025
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = $this->getIO($input, $output);

        $configurationFile = $input->getOption('working-dir').'/accompli.json';

        $filesystem = new Filesystem();
        if ($filesystem->exists($configurationFile) === false || $io->confirm('An Accompli configuration file already exists. Do you wish to overwrite it?')) {
            $filesystem->dumpFile($configurationFile, $this->getJsonEncodedConfiguration());
        }
    }
640325
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->injectOutputIntoLogger($output, $this->logger);
        $output->writeln($this->crypt->generateKey());
        return 0;
    }
594086
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;

        try {
            return $this->fire();
        } catch (DomainException $e) {
            return 1;
        } catch (Exception $e) {
            $this->error($e->getMessage());
            $this->error('Abort!');
        }

        return;
    }
910022
protected function execute(InputInterface $input, OutputInterface $output): ?int
    {
        $username = $this->getUsername($input, $output);
        $user = $this->findUser($output, $username);
        if (null === $user) {
            return 1;
        }

        $password = $this->getPassword($input, $output);
        if ($password) {
            $this->userManager->setPlainTextPassword($user, $password);
        } else {
            $this->userManager->requestNewPassword($user);
        }
        $this->userManager->save($user);

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

        return 0;
    }
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>");
        }
    }
87012
protected function loadConfig(InputInterface $input, OutputInterface $output)
    {
        $configFilePath = $this->locateConfigFile($input);
        $output->writeln('<info>using config file</info> .' . str_replace(getcwd(), '', realpath($configFilePath)));

        $parser = $input->getOption('parser');

        // If no parser is specified try to determine the correct one from the file extension.  Defaults to YAML
        if ($parser === null) {
            $extension = pathinfo($configFilePath, PATHINFO_EXTENSION);

            switch (strtolower($extension)) {
                case 'json':
                    $parser = 'json';
                    break;
                case 'php':
                    $parser = 'php';
                    break;
                case 'yml':
                default:
                    $parser = 'yaml';
            }
        }

        switch (strtolower($parser)) {
            case 'json':
                $config = Config::fromJson($configFilePath);
                break;
            case 'php':
                $config = Config::fromPhp($configFilePath);
                break;
            case 'yaml':
                $config = Config::fromYaml($configFilePath);
                break;
            default:
                throw new \InvalidArgumentException(sprintf('\'%s\' is not a valid parser.', $parser));
        }

        $output->writeln('<info>using config parser</info> ' . $parser);

        $this->setConfig($config);
    }
1372950
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->configureOptions($input);

        $rows = $failed = array();
        foreach ($this->finder->findAll() as $release) {
            $this->locator->setParams(array('release' => $release));
            $scripts = $rollbacks = array();
            $status  = '<fg=green>OK</fg=green>';

            try {
                $scripts   = $this->locator->findScripts();
                $rollbacks = $this->locator->findRollbackScripts();
                $this->checker->check($scripts, $rollbacks);
            } catch (\Exception $e) {
                $status   = sprintf('<fg=red>%s</fg=red>', $e->getMessage());
                $failed[] = $release;
            }

            $rows[] = array($release, count($scripts), count($rollbacks), $status);
        }

        $this->display($output, $rows, $failed);
    }
179708
protected function execute(InputInterface $input, OutputInterface $output) : int
    {
        $logger = LoggerHelper::createDefaultLogger($output);

        /** @var string $cacheOption */
        $cacheOption = $input->getOption('cache');
        $fileCache = new FilesystemCache($cacheOption);
        $cache = new SimpleCacheAdapter($fileCache);

        $logger->info('initializing converting process');

        $browscap = new BrowscapUpdater($cache, $logger);

        $logger->info('started converting local file');

        /** @var string $file */
        $file = $input->getArgument('file');
        if (! $file) {
            $file = $this->defaultIniFile;
        }

        $output->writeln(sprintf('converting file %s', $file));

        try {
            $browscap->convertFile($file);
        } catch (Exception\FileNameMissingException $e) {
            $logger->debug($e);

            return 6;
        } catch (Exception\FileNotFoundException $e) {
            $logger->debug($e);

            return 7;
        } catch (Exception\ErrorReadingFileException $e) {
            $logger->debug($e);

            return 8;
        }

        $logger->info('finished converting local file');

        return 0;
    }
370118
public function run(InputInterface $input, OutputInterface $output): int
    {
        $command = (string) $input;
        $command = strtr($command, [
            ' -name' => ' -N',
            ' -type' => ' -T',
            ' -maxdepth' => ' -M',
            ' -delete' => ' -d true',
        ]);

        return parent::run(new StringInput($command), $output);
    }
815015
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path = $input->getArgument('path');
        $excludes = $input->getOption('exclude');
        $verbose = $output->getVerbosity();
        $configValue = $this->getUsableConfig($input);

        if ($verbose >= OutputInterface::VERBOSITY_VERBOSE) {
            $this
                ->printInitMessage(
                    $input,
                    $output,
                    $path,
                    $excludes
                );
            $output->writeln('#');
            $output->writeln('# Executing process with this configuration');
            $this->printUsableConfig($output, $configValue);
        }

        $files = $this
            ->loadFiles(
                $path,
                $excludes
            );

        if ($verbose >= OutputInterface::VERBOSITY_VERBOSE) {
            $output->writeln('# Found ' . $files->count() . ' files');
            $output->writeln('# Starting format...');
            $output->writeln('#');
        }

        $fixer = $this->getFixer($configValue);
        $this->fixFiles(
            $input,
            $output,
            $files,
            $fixer
        );
    }
311377
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $filename = $input->getArgument('filename');
        $key = $input->getArgument('key');
        $yaml_parsed = $this->loadYamlFile($filename);
        if (!$yaml_parsed) {
            // Exit with a status of 1.
            return 1;
        }

        $data = new Data($yaml_parsed);
        if (!$this->checkKeyExists($data, $key)) {
            return 1;
        }

        $value = $data->get($key);
        $output->writeln(trim(Yaml::dump($value)));
    }
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;
    }
690408
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $configDataProvider = new DumperConfigDataProvider();
        $configDataProvider->setVolume($input->getArgument('volume'));
        $configDataProvider->setPath($input->getArgument('path'));
        $configDataProvider->setVersion($input->getArgument('version'));
        $configDataProvider->setEngine();

        $this->getFacade()->dump($configDataProvider);
    }
393817
protected function execute(InputInterface $input, OutputInterface $output)
  {
    $name = $input->getArgument('name');

    if ($this->add($name)) {
      return $output->writeln('<info>Trait "' . $name . '" has been successfully created.</info>');
    }

    return $output->writeln('File "' . $name . '" already exists.');
  }
152012
protected function execute(InputInterface $input, OutputInterface $output) : int
    {
        $logger = LoggerHelper::createDefaultLogger($output);

        /** @var string $cacheOption */
        $cacheOption = $input->getOption('cache');
        $fileCache = new FilesystemCache($cacheOption);
        $cache = new SimpleCacheAdapter($fileCache);

        $logger->debug('started checking for new version of remote file');

        $browscap = new BrowscapUpdater($cache, $logger);

        try {
            $browscap->checkUpdate();
        } catch (NoCachedVersionException $e) {
            return 1;
        } catch (NoNewVersionException $e) {
            // no newer version available
            $logger->info('there is no newer version available');

            return 2;
        } catch (ErrorCachedVersionException $e) {
            $logger->info($e);

            return 3;
        } catch (FetcherException $e) {
            $logger->info($e);

            return 4;
        } catch (\Throwable $e) {
            $logger->info($e);

            return 5;
        }

        $logger->debug('finished checking for new version of remote file');

        return 0;
    }
767815
protected function loadConfiguration(InputInterface $input)
    {
        $loader = new ConfigurationLoader();

        if ($input->hasOption('config') && $file = $input->getOption('config')) {
            $configuration = $loader->loadFromFile($file);
        } else {
            
            if (null === $this->container) {
                throw new Exception('Unable to find the assets configuration from the container');
            }
            $configuration = $loader->loadFromContainer($this->container);
        }

        return $configuration;
    }