コード例 #1
0
ファイル: Analyzer.php プロジェクト: kingsj/core
 /**
  * This method calculates the NPath Complexity of a while-statement, the
  * meassured value is then returned as a string.
  *
  * <code>
  * while (<expr>)
  *   <while-range>
  * S;
  *
  * -- NP(while) = NP(<while-range>) + NP(<expr>) + 1 --
  * </code>
  *
  * @param PHP_Depend_Code_ASTNodeI $node The currently visited node.
  * @param string                   $data The previously calculated npath value.
  *
  * @return string
  * @since 0.9.12
  */
 public function visitWhileStatement($node, $data)
 {
     $expr = $this->sumComplexity($node->getChild(0));
     $stmt = $node->getChild(1)->accept($this, 1);
     $npath = PHP_Depend_Util_MathUtil::add($expr, $stmt);
     $npath = PHP_Depend_Util_MathUtil::add($npath, '1');
     return PHP_Depend_Util_MathUtil::mul($npath, $data);
 }