function ComplexityCalculatingVisitor::enterNode
Overrides NodeVisitorAbstract::enterNode
File
-
vendor/
sebastian/ complexity/ src/ Visitor/ ComplexityCalculatingVisitor.php, line 39
Class
Namespace
SebastianBergmann\ComplexityCode
public function enterNode(Node $node) : ?int {
if (!$node instanceof ClassMethod && !$node instanceof Function_) {
return null;
}
if ($node instanceof ClassMethod) {
if ($node->getAttribute('parent') instanceof Interface_) {
return null;
}
if ($node->isAbstract()) {
return null;
}
$name = $this->classMethodName($node);
}
else {
$name = $this->functionName($node);
}
$statements = $node->getStmts();
assert(is_array($statements));
$this->result[] = new Complexity($name, $this->cyclomaticComplexity($statements));
if ($this->shortCircuitTraversal) {
return NodeTraverser::DONT_TRAVERSE_CHILDREN;
}
return null;
}