class TokenParser (View source)

Parses a file for namespaces/use/class declarations.

Methods

__construct(string $contents)

No description

array|null
next(boolean $docCommentIsComment = TRUE)

Gets the next non whitespace and non comment token.

array
parseUseStatement()

Parses a single use statement.

array
parseUseStatements(string $namespaceName)

Gets all use statements.

string
parseNamespace()

Gets the namespace.

string
parseClass()

Gets the class name.

Details

__construct(string $contents)

Parameters

string $contents

array|null next(boolean $docCommentIsComment = TRUE)

Gets the next non whitespace and non comment token.

Parameters

boolean $docCommentIsComment If TRUE then a doc comment is considered a comment and skipped. If FALSE then only whitespace and normal comments are skipped.

Return Value

array|null The token if exists, null otherwise.

array parseUseStatement()

Parses a single use statement.

Return Value

array A list with all found class names for a use statement.

array parseUseStatements(string $namespaceName)

Gets all use statements.

Parameters

string $namespaceName The namespace name of the reflected class.

Return Value

array A list with all found use statements.

string parseNamespace()

Gets the namespace.

Return Value

string The found namespace.

string parseClass()

Gets the class name.

Return Value

string The found class name.