Inheritance: extends Symfony\Component\Console\Command\Command
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $io = new SymfonyStyle($input, $output);
     $io->title('Advisor debug information');
     $advisorId = $input->getOption('advisor');
     if (!$advisorId) {
         $this->showAdvisorsList($io);
     } else {
         $this->showAdvisorInformation($io, $advisorId);
     }
 }
Beispiel #2
0
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $io = new SymfonyStyle($input, $output);
     $container = $this->aspectKernel->getContainer();
     $aspects = [];
     $io->title('Aspect debug information');
     $aspectName = $input->getOption('aspect');
     if (!$aspectName) {
         $io->text('<info>' . get_class($this->aspectKernel) . '</info> has following enabled aspects:');
         $aspects = $container->getByTag('aspect');
     } else {
         $aspect = $container->getAspect($aspectName);
         $aspects[] = $aspect;
     }
     $this->showRegisteredAspectsInfo($io, $aspects);
 }
Beispiel #3
0
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $options = $this->aspectKernel->getOptions();
     if (empty($options['cacheDir'])) {
         throw new \InvalidArgumentException("Cache warmer require the `cacheDir` options to be configured");
     }
     $enumerator = new Enumerator($options['appDir'], $options['includePaths'], $options['excludePaths']);
     $iterator = $enumerator->enumerate();
     $totalFiles = iterator_count($iterator);
     $output->writeln("Total <info>{$totalFiles}</info> files to process.");
     $iterator->rewind();
     set_error_handler(function ($errno, $errstr, $errfile, $errline) {
         throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
     });
     $index = 0;
     $errors = [];
     foreach ($iterator as $file) {
         if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
             $output->writeln("Processing file <info>{$file->getRealPath()}</info>");
         }
         $isSuccess = null;
         try {
             // This will trigger creation of cache
             file_get_contents(FilterInjectorTransformer::PHP_FILTER_READ . SourceTransformingLoader::FILTER_IDENTIFIER . "/resource=" . $file->getRealPath());
             $isSuccess = true;
         } catch (\Exception $e) {
             $isSuccess = false;
             $errors[$file->getRealPath()] = $e;
         }
         if ($output->getVerbosity() == OutputInterface::VERBOSITY_NORMAL) {
             $output->write($isSuccess ? '.' : '<error>E</error>');
             if (++$index % 50 == 0) {
                 $output->writeln("({$index}/{$totalFiles})");
             }
         }
     }
     restore_error_handler();
     if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) {
         foreach ($errors as $file => $error) {
             $message = "File {$file} is not processed correctly due to exception: {$error->getMessage()}";
             $output->writeln($message);
         }
     }
     $output->writeln("<info>Done</info>");
 }