示例#1
0
文件: Loc.php 项目: jubinpatel/horde
 /**
  * Run the task.
  *
  * @param array &$options Additional options.
  *
  * @return integer Number of errors.
  */
 public function run(&$options)
 {
     require 'SebastianBergmann/FinderFacade/autoload.php';
     require 'SebastianBergmann/PHPLOC/autoload.php';
     $finder = new SebastianBergmann\FinderFacade\FinderFacade(array(realpath($this->_config->getPath())));
     $files = $finder->findFiles();
     $analyser = new SebastianBergmann\PHPLOC\Analyser(new \ezcConsoleOutput());
     $count = $analyser->countFiles($files, true);
     $printer = new SebastianBergmann\PHPLOC\TextUI\ResultPrinter();
     $printer->printResult($count, true);
 }
示例#2
0
 protected function runPhpLocCheck()
 {
     $files = $this->getFilesToCheck();
     $result = $this->getCountForFiles($files);
     if ($this->reportType === 'cli' || $this->reportType === 'txt') {
         require_once 'SebastianBergmann/PHPLOC/TextUI/ResultPrinter.php';
         $printer = new SebastianBergmann\PHPLOC\TextUI\ResultPrinter();
         ob_start();
         $printer->printResult($result, $this->countTests);
         $result = ob_get_contents();
         ob_end_clean();
         if ($this->reportType === 'txt') {
             file_put_contents($this->reportDirectory . DIRECTORY_SEPARATOR . $this->reportFileName, $result);
             $reportDir = new PhingFile($this->reportDirectory);
             $logMessage = "Writing report to: " . $reportDir->getAbsolutePath() . DIRECTORY_SEPARATOR . $this->reportFileName;
             $this->log($logMessage);
         } else {
             $this->log("\n" . $result);
         }
     } elseif ($this->reportType === 'xml' || $this->reportType === 'csv') {
         $printerClass = sprintf('SebastianBergmann_PHPLOC_Log_%s', strtoupper($this->reportType));
         $printerClassFile = str_replace('_', DIRECTORY_SEPARATOR, $printerClass) . '.php';
         require_once $printerClassFile;
         $printerClass = str_replace('_', '\\', $printerClass);
         $printer = new $printerClass();
         $reportDir = new PhingFile($this->reportDirectory);
         $logMessage = "Writing report to: " . $reportDir->getAbsolutePath() . DIRECTORY_SEPARATOR . $this->reportFileName;
         $this->log($logMessage);
         $printer->printResult($this->reportDirectory . DIRECTORY_SEPARATOR . $this->reportFileName, $result);
     }
 }