class TokenParser (View source)

Parses a file for namespaces/use/class declarations.

Methods

__construct($contents)

No description

array
next($docCommentIsComment = TRUE)

Gets the next non whitespace and non comment token.

array
parseUseStatement()

Parse a single use statement.

array
parseUseStatements(string $namespaceName)

Get all use statements.

string
parseNamespace()

Get the namespace.

string
parseClass()

Get the class name.

Details

__construct($contents)

Parameters

$contents

array next($docCommentIsComment = TRUE)

Gets the next non whitespace and non comment token.

Parameters

$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 The token if exists, null otherwise.

array parseUseStatement()

Parse a single use statement.

Return Value

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

array parseUseStatements(string $namespaceName)

Get 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()

Get the namespace.

Return Value

string The found namespace.

string parseClass()

Get the class name.

Return Value

string The foundclass name.