Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Counter.php

function Counter::countInAbstractSyntaxTree

@psalm-param non-negative-int $linesOfCode

Parameters

Node[] $nodes:

Throws

RuntimeException

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

Counter

Namespace

SebastianBergmann\LinesOfCode

Code

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();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal