Пример #1
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $source = $input->getArgument('source');
     if (is_dir($source) === false && is_file($source) === false) {
         throw new \InvalidArgumentException(sprintf('"%s" is not a file or a directory', $source));
     }
     $logger = new Logger($this->output, $input->getOption('debug'));
     if (is_dir($source) === true) {
         $collector = new DirectoryCodeCollector(array($source));
     } elseif (is_file($source) === true) {
         $collector = new FileCodeCollector(array($source));
     }
     foreach ($this->engine->convert($collector, $logger, $input->getArgument('file')) as $file) {
         $this->fileRender->render($file);
     }
     $table = new Table($this->output);
     $table->setHeaders(array(array(new TableCell('Incompatibility', array('colspan' => 4))), array('Type', 'Message', 'Line', 'Class')));
     $table->setRows($logger->getIncompatibility());
     $table->render();
     if ($input->getOption('v') === true) {
         $table = new Table($this->output);
         $table->setHeaders(array(array(new TableCell('Log', array('colspan' => 3))), array('Message', 'Line', 'Class')));
         $table->setRows($logger->getLogs());
         $table->render();
     }
 }
Пример #2
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $directory = $input->getArgument('dir');
     if (is_dir($directory) === false) {
         throw new \InvalidArgumentException(sprintf('Directory "%s" does not exist', $directory));
     }
     $logger = new Logger($this->output, $input->getOption('debug'));
     $directoryCollector = new DirectoryCodeCollector(array($directory));
     foreach ($this->engine->convert($directoryCollector, $logger, $input->getArgument('file')) as $file) {
         $this->fileRender->render($file);
     }
 }