Ejemplo n.º 1
0
 /**
  * Visits methods, functions or closures and calculated their complexity.
  *
  * @param PHP_Depend_Code_AbstractCallable $callable The visited callable.
  *
  * @return void
  * @since 0.9.8
  */
 public function calculateComplexity(PHP_Depend_Code_AbstractCallable $callable)
 {
     $data = array(self::M_CYCLOMATIC_COMPLEXITY_1 => 1, self::M_CYCLOMATIC_COMPLEXITY_2 => 1);
     foreach ($callable->getChildren() as $child) {
         $data = $child->accept($this, $data);
     }
     $this->_storeNodeComplexityAndUpdateProject($callable->getUUID(), $data);
 }
Ejemplo n.º 2
0
 /**
  * This method will calculate the NPath complexity for the given callable
  * instance.
  *
  * @param PHP_Depend_Code_AbstractCallable $callable The context callable.
  *
  * @return void
  * @since 0.9.12
  */
 protected function calculateComplexity(PHP_Depend_Code_AbstractCallable $callable)
 {
     $npath = '1';
     foreach ($callable->getChildren() as $child) {
         $stmt = $child->accept($this, $npath);
         $npath = PHP_Depend_Util_MathUtil::mul($npath, $stmt);
     }
     $this->_metrics[$callable->getUUID()] = $npath;
 }
Ejemplo n.º 3
0
 /**
  * Visits methods, functions or closures and calculated their complexity.
  *
  * @param PHP_Depend_Code_AbstractCallable $callable The visited callable.
  *
  * @return void
  * @since 0.9.8
  */
 public function calculateComplexity(PHP_Depend_Code_AbstractCallable $callable)
 {
     $data = array(self::M_CYCLOMATIC_COMPLEXITY_1 => 1, self::M_CYCLOMATIC_COMPLEXITY_2 => 1);
     foreach ($callable->getChildren() as $child) {
         $data = $child->accept($this, $data);
     }
     $this->metrics[$callable->getUuid()] = $data;
 }