private function PhpParser::getFileContent in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_annotation_discovery/lib/Doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php \Doctrine\Common\Annotations\PhpParser::getFileContent()
Gets the content of the file right up to the given line number.
Parameters
string $filename The name of the file to load.:
integer $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 modules/
providers/ service_container_annotation_discovery/ lib/ Doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ PhpParser.php - Parses a class.
File
- modules/
providers/ service_container_annotation_discovery/ lib/ Doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ PhpParser.php, line 72
Class
- PhpParser
- Parses a file for namespaces/use/class declarations.
Namespace
Doctrine\Common\AnnotationsCode
private function getFileContent($filename, $lineNumber) {
if (!is_file($filename)) {
return null;
}
$content = '';
$lineCnt = 0;
$file = new SplFileObject($filename);
while (!$file
->eof()) {
if ($lineCnt++ == $lineNumber) {
break;
}
$content .= $file
->fgets();
}
return $content;
}