Exemplo n.º 1
0
 /**
  * Constructor.
  *
  * @param $filename string       	
  * @param $codeCoverage array       	
  * @throws RuntimeException
  */
 protected function __construct($filename, &$codeCoverage = array())
 {
     if (!file_exists($filename)) {
         throw new RuntimeException(sprintf('File "%s" not found.', $filename));
     }
     $this->filename = $filename;
     foreach (PHPCoverage_Util_File::countLines($this->filename) as $name => $value) {
         $this->{$name} = $value;
     }
     $this->setCoverage($codeCoverage);
     foreach (PHPCoverage_Util_File::getClassesInFile($filename) as $className => $class) {
         $this->classes[$className] = PHPCoverage_Util_Metrics_Class::factory(new ReflectionClass($className), $codeCoverage);
     }
     foreach (PHPCoverage_Util_File::getFunctionsInFile($filename) as $functionName => $function) {
         $this->functions[$functionName] = PHPCoverage_Util_Metrics_Function::factory(new ReflectionFunction($functionName), $codeCoverage);
     }
 }