function Counter::countInAbstractSyntaxTree
@psalm-param non-negative-int $linesOfCode
Parameters
Node[] $nodes:
Throws
1 call to Counter::countInAbstractSyntaxTree()
- Counter::countInSourceString in vendor/
sebastian/ lines-of-code/ src/ Counter.php
File
-
vendor/
sebastian/ lines-of-code/ src/ Counter.php, line 68
Class
Namespace
SebastianBergmann\LinesOfCodeCode
public function countInAbstractSyntaxTree(int $linesOfCode, array $nodes) : LinesOfCode {
$traverser = new NodeTraverser();
$visitor = new LineCountingVisitor($linesOfCode);
$traverser->addVisitor($visitor);
try {
/* @noinspection UnusedFunctionResultInspection */
$traverser->traverse($nodes);
// @codeCoverageIgnoreStart
} catch (Error $error) {
throw new RuntimeException($error->getMessage(), $error->getCode(), $error);
}
// @codeCoverageIgnoreEnd
return $visitor->result();
}