/**
* 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;
}