PDepend\Metrics\Analyzer\NodeLocAnalyzer::visitMethod PHP Method

visitMethod() public method

Visits a method node.
public visitMethod ( PDepend\Source\AST\ASTMethod $method ) : void
$method PDepend\Source\AST\ASTMethod
return void
    public function visitMethod(ASTMethod $method)
    {
        $this->fireStartMethod($method);
        if ($this->restoreFromCache($method)) {
            return $this->fireEndMethod($method);
        }
        if ($method->isAbstract()) {
            $cloc = 0;
            $eloc = 0;
            $lloc = 0;
        } else {
            list($cloc, $eloc, $lloc) = $this->linesOfCode($method->getTokens(), true);
        }
        $loc = $method->getEndLine() - $method->getStartLine() + 1;
        $ncloc = $loc - $cloc;
        $this->metrics[$method->getId()] = array(self::M_LINES_OF_CODE => $loc, self::M_COMMENT_LINES_OF_CODE => $cloc, self::M_EXECUTABLE_LINES_OF_CODE => $eloc, self::M_LOGICAL_LINES_OF_CODE => $lloc, self::M_NON_COMMENT_LINES_OF_CODE => $ncloc);
        $this->classExecutableLines += $eloc;
        $this->classLogicalLines += $lloc;
        $this->fireEndMethod($method);
    }