PhpCsFixer\Console\Command\FixCommand::execute PHP Метод

execute() защищенный Метод

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)
    {
        $verbosity = $output->getVerbosity();
        $resolver = new ConfigurationResolver($this->defaultConfig, array('allow-risky' => $input->getOption('allow-risky'), 'config' => $input->getOption('config'), 'dry-run' => $input->getOption('dry-run'), 'rules' => $input->getOption('rules'), 'path' => $input->getArgument('path'), 'path-mode' => $input->getOption('path-mode'), 'using-cache' => $input->getOption('using-cache'), 'cache-file' => $input->getOption('cache-file'), 'format' => $input->getOption('format'), 'diff' => $input->getOption('diff'), 'verbosity' => $verbosity), getcwd());
        $reporter = $resolver->getReporter();
        $stdErr = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : ('txt' === $reporter->getFormat() ? $output : null);
        if (null !== $stdErr && extension_loaded('xdebug')) {
            $stdErr->writeln(sprintf($stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s', 'You are running php-cs-fixer with xdebug enabled. This has a major impact on runtime performance.'));
        }
        $configFile = $resolver->getConfigFile();
        if (null !== $stdErr) {
            $stdErr->writeln(sprintf('Loaded config <comment>%s</comment>%s.', $resolver->getConfig()->getName(), null === $configFile ? '' : ' from "' . $configFile . '"'));
        }
        if (null !== $stdErr && $resolver->getUsingCache()) {
            $cacheFile = $resolver->getCacheFile();
            if (is_file($cacheFile)) {
                $stdErr->writeln(sprintf('Using cache file "%s".', $cacheFile));
            }
        }
        $showProgress = $resolver->getProgress();
        $runner = new Runner($resolver->getFinder(), $resolver->getFixers(), $resolver->getDiffer(), $showProgress ? $this->eventDispatcher : null, $this->errorsManager, $resolver->getLinter(), $resolver->isDryRun(), $resolver->getCacheManager());
        $progressOutput = $showProgress && $stdErr ? new ProcessOutput($stdErr, $this->eventDispatcher) : new NullOutput();
        $this->stopwatch->start('fixFiles');
        $changed = $runner->fix();
        $this->stopwatch->stop('fixFiles');
        $progressOutput->printLegend();
        $fixEvent = $this->stopwatch->getEvent('fixFiles');
        $reportSummary = new ReportSummary($changed, $fixEvent->getDuration(), $fixEvent->getMemory(), OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity(), $resolver->isDryRun(), $output->isDecorated());
        if ($output->isDecorated()) {
            $output->write($reporter->generate($reportSummary));
        } else {
            $output->write($reporter->generate($reportSummary), false, OutputInterface::OUTPUT_RAW);
        }
        $invalidErrors = $this->errorsManager->getInvalidErrors();
        $exceptionErrors = $this->errorsManager->getExceptionErrors();
        $lintErrors = $this->errorsManager->getLintErrors();
        if (null !== $stdErr) {
            if (count($invalidErrors) > 0) {
                $this->listErrors($stdErr, 'linting before fixing', $invalidErrors);
            }
            if (count($exceptionErrors) > 0) {
                $this->listErrors($stdErr, 'fixing', $exceptionErrors);
            }
            if (count($lintErrors) > 0) {
                $this->listErrors($stdErr, 'linting after fixing', $lintErrors);
            }
        }
        return $this->calculateExitStatus($resolver->isDryRun(), count($changed) > 0, count($invalidErrors) > 0, count($exceptionErrors) > 0);
    }