PDepend\TextUI\Runner::addReportGenerator PHP Method

addReportGenerator() public method

Adds a logger to this runner.
public addReportGenerator ( string $generatorId, string $reportFile ) : void
$generatorId string
$reportFile string
return void
    public function addReportGenerator($generatorId, $reportFile)
    {
        $this->loggerMap[$generatorId] = $reportFile;
    }

Usage Example

 /**
  * Executes the runner class and returns an array with namespace statistics.
  *
  * @param \PDepend\TextUI\Runner $runner The runner instance.
  * @param $pathName The source path.
  * @return array
  */
 private function _runRunnerAndReturnStatistics(Runner $runner, $pathName)
 {
     $logFile = self::createRunResourceURI();
     $runner->setSourceArguments(array($pathName));
     $runner->addReportGenerator('dummy-logger', $logFile);
     $this->silentRun($runner);
     $data = unserialize(file_get_contents($logFile));
     $code = $data['code'];
     $actual = array();
     foreach ($code as $namespace) {
         $statistics = array('functions' => array(), 'classes' => array(), 'interfaces' => array(), 'exceptions' => array());
         foreach ($namespace->getFunctions() as $function) {
             $statistics['functions'][] = $function->getName();
             foreach ($function->getExceptionClasses() as $exception) {
                 $statistics['exceptions'][] = $exception->getName();
             }
         }
         foreach ($namespace->getClasses() as $class) {
             $statistics['classes'][] = $class->getName();
         }
         foreach ($namespace->getInterfaces() as $interface) {
             $statistics['interfaces'][] = $interface->getName();
         }
         sort($statistics['functions']);
         sort($statistics['classes']);
         sort($statistics['interfaces']);
         sort($statistics['exceptions']);
         $actual[$namespace->getName()] = $statistics;
     }
     ksort($actual);
     return $actual;
 }
All Usage Examples Of PDepend\TextUI\Runner::addReportGenerator