private function PhpParser::getFileContent

Get the content of the file right up to the given line number.

Parameters

string $filename The name of the file to load.:

int $lineNumber The number of lines to read from file.:

Return value

string The content of the file.

1 call to PhpParser::getFileContent()
PhpParser::parseClass in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php
Parses a class.

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php, line 65

Class

PhpParser
Parses a file for namespaces/use/class declarations.

Namespace

Doctrine\Common\Annotations

Code

private function getFileContent($filename, $lineNumber) {
  $content = '';
  $lineCnt = 0;
  $file = new SplFileObject($filename);
  while (!$file
    ->eof()) {
    if ($lineCnt++ == $lineNumber) {
      break;
    }
    $content .= $file
      ->fgets();
  }
  return $content;
}