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

Breadcrumb

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

function LineCountingVisitor::result

File

vendor/sebastian/lines-of-code/src/LineCountingVisitor.php, line 57

Class

LineCountingVisitor

Namespace

SebastianBergmann\LinesOfCode

Code

public function result() : LinesOfCode {
    $commentLinesOfCode = 0;
    foreach ($this->comments() as $comment) {
        $commentLinesOfCode += $comment->getEndLine() - $comment->getStartLine() + 1;
    }
    $nonCommentLinesOfCode = $this->linesOfCode - $commentLinesOfCode;
    $logicalLinesOfCode = count(array_unique($this->linesWithStatements));
    assert($commentLinesOfCode >= 0);
    assert($nonCommentLinesOfCode >= 0);
    assert($logicalLinesOfCode >= 0);
    return new LinesOfCode($this->linesOfCode, $commentLinesOfCode, $nonCommentLinesOfCode, $logicalLinesOfCode);
}

API Navigation

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