Пример #1
0
 /**
  * Constructor.
  *
  * @param $scope string       	
  * @param $function ReflectionFunction|ReflectionMethod       	
  * @param $codeCoverage array       	
  */
 protected function __construct($scope, $function, &$codeCoverage = array())
 {
     $this->scope = $scope;
     $this->function = $function;
     $source = PHPCoverage_Util_Class::getMethodSource($scope, $function->getName());
     if ($source !== FALSE) {
         $this->tokens = token_get_all('<?php' . $source . '?>');
         $this->parameters = $function->getNumberOfParameters();
         $this->calculateCCN();
         $this->calculateNPath();
         $this->calculateDependencies();
     }
     $this->setCoverage($codeCoverage);
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @param $class ReflectionClass       	
  * @param $codeCoverage array       	
  */
 protected function __construct(ReflectionClass $class, &$codeCoverage = array())
 {
     $this->class = $class;
     $className = $class->getName();
     $packageInformation = PHPCoverage_Util_Class::getPackageInformation($className, $class->getDocComment());
     if (!empty($packageInformation['fullPackage'])) {
         $this->package = $packageInformation['fullPackage'];
     }
     $this->setCoverage($codeCoverage);
     $this->dit = count(PHPCoverage_Util_Class::getHierarchy($class->getName())) - 1;
     $this->impl = count($class->getInterfaces());
     foreach ($this->class->getMethods() as $method) {
         if ($method->getDeclaringClass()->getName() == $className) {
             $this->methods[$method->getName()] = PHPCoverage_Util_Metrics_Function::factory($method, $codeCoverage);
         } else {
             $this->inheritedMethods[$method->getName()] = PHPCoverage_Util_Metrics_Function::factory($method, $codeCoverage);
         }
     }
     $this->calculateAttributeMetrics();
     $this->calculateMethodMetrics();
     $this->calculateNumberOfChildren();
     $this->calculatePolymorphismFactor();
     $this->calculateDependencies();
 }
Пример #3
0
 /**
  * Starts the collection of loaded classes.
  */
 public static function collectStart()
 {
     self::$buffer = get_declared_classes();
 }