PhpParser
in package
Parses a file for namespaces/use/class declarations.
Table of Contents
- parseClass() : array<string, class-string>
- Parses a class.
- parseUseStatements() : array<string|int, mixed>
- Parse a class or function for use statements.
- getFileContent() : string|null
- Gets the content of the file right up to the given line number.
Methods
parseClass()
Parses a class.
public
parseClass(ReflectionClass $class) : array<string, class-string>
Parameters
- $class : ReflectionClass
-
A
ReflectionClass
object.
Tags
Return values
array<string, class-string> —A list with use statements in the form (Alias => FQN).
parseUseStatements()
Parse a class or function for use statements.
public
parseUseStatements(ReflectionClass|ReflectionFunction $reflection) : array<string|int, mixed>
Parameters
- $reflection : ReflectionClass|ReflectionFunction
Tags
Return values
array<string|int, mixed> —getFileContent()
Gets the content of the file right up to the given line number.
private
getFileContent(string $filename, int $lineNumber) : string|null
Parameters
- $filename : string
-
The name of the file to load.
- $lineNumber : int
-
The number of lines to read from file.
Return values
string|null —The content of the file or null if the file does not exist.