getChild() публичный Метод

Returns the node instance for the given index or throws an exception.
public getChild ( integer $index ) : PDepend\Source\AST\ASTNode
$index integer
Результат PDepend\Source\AST\ASTNode
Пример #1
0
 /**
  * Returns a child node at the given index.
  *
  * @param integer $index The child offset.
  *
  * @return \PHPMD\Node\ASTNode
  */
 public function getChild($index)
 {
     return new ASTNode($this->node->getChild($index), $this->getFileName());
 }
Пример #2
0
 /**
  * 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 \PDepend\Source\AST\ASTNode $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 = MathUtil::add($expr, $stmt);
     $npath = MathUtil::add($npath, '1');
     return MathUtil::mul($npath, $data);
 }