Beispiel #1
0
 /**
  * @inheritdoc
  */
 public function terminate(ResultCollection $collection, ResultCollection $groupedResults)
 {
     $output = new BufferedOutput(OutputInterface::VERBOSITY_NORMAL, true);
     $output->write(str_pad("\r", 80, " "));
     $output->writeln('');
     // overview
     $total = $this->bound->calculate($collection);
     $output->writeln(sprintf('<info>%d</info> files have been analyzed. Read and understand these <info>%s</info> lines of code will take around <info>%s</info>.', sizeof($collection, COUNT_NORMAL), $total->getSum('loc'), $this->formatTime($total->getSum('time'))));
     $output->writeln('<info>Average for each module:</info>');
     $output->writeln('');
     $hasOOP = null !== $total->getSum('instability');
     $table = new TableHelper();
     $table->setHeaders(array_merge(array('Name', 'Complexity', 'Myer Distance', 'Maintenability', 'LLOC', 'Comment weight', 'Vocabulary', 'Volume', 'Bugs', 'Difficulty'), $hasOOP ? array('lcom', 'SysComplexity', 'Instability', 'Abstractness', 'ce', 'ca') : array()))->setLayout(TableHelper::LAYOUT_DEFAULT);
     foreach ($groupedResults as $result) {
         $table->addRow(array_merge(array(str_repeat('  ', $result->getDepth()) . $result->getName(), $this->getRow($result->getBounds(), 'cyclomaticComplexity', 'average', 0), $this->getRow($result->getBounds(), 'myerDistance', 'average', 0), $this->getRow($result->getBounds(), 'maintenabilityIndex', 'average', 0), $this->getRow($result->getBounds(), 'logicalLoc', 'sum', 0), $this->getRow($result->getBounds(), 'commentWeight', 'average', 0), $this->getRow($result->getBounds(), 'vocabulary', 'average', 0), $this->getRow($result->getBounds(), 'volume', 'average', 0), $this->getRow($result->getBounds(), 'bugs', 'sum', 2), $this->getRow($result->getBounds(), 'difficulty', 'average', 0)), $hasOOP ? array($this->getRow($result->getBounds(), 'lcom', 'average', 2), $this->getRow($result->getBounds(), 'rsysc', 'average', 2), $result->getInstability()->getInstability(), $result->getAbstractness()->getAbstractness(), $this->getRow($result->getBounds(), 'efferentCoupling', 'average', 2), $this->getRow($result->getBounds(), 'afferentCoupling', 'average', 2)) : array()));
     }
     $table->render($output);
     return $output->fetch();
 }
 public function getFirefoxVersion()
 {
     if ($this->isWindows()) {
         $cmd = 'reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Mozilla\\Mozilla Firefox" | findstr /i CurrentVersion';
         $match = '/REG_SZ[\\s]+([0-9.]+)/is';
     } else {
         $cmd = 'firefox --version';
         $match = '/Mozilla Firefox ([0-9.]+)/is';
     }
     $output = new BufferedOutput();
     $process = new Process($cmd, SeleniumSetup::$APP_ROOT_PATH, SeleniumSetup::$APP_PROCESS_ENV, null, null);
     $process->run(function ($type, $line) use($output) {
         $output->write($line);
     });
     preg_match($match, $output->fetch(), $matches);
     return isset($matches[1]) ? $matches[1] : null;
 }
 /**
  * {@inheritdoc}
  */
 public function newLine($count = 1)
 {
     parent::newLine($count);
     $this->outputBuffered->write(str_repeat("\n", $count));
 }