PDepend\Metrics\Analyzer\NPathComplexityAnalyzer::visitDoWhileStatement PHP Method

visitDoWhileStatement() public method

do while () S; -- NP(do) = NP() + NP() + 1 --
Since: 0.9.12
public visitDoWhileStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
$data string The previously calculated npath value.
return string
    public function visitDoWhileStatement($node, $data)
    {
        $stmt = $node->getChild(0)->accept($this, 1);
        $expr = $this->sumComplexity($node->getChild(1));
        $npath = MathUtil::add($expr, $stmt);
        $npath = MathUtil::add($npath, '1');
        return MathUtil::mul($npath, $data);
    }