Comment
in package
Table of Contents
Methods
- tokenizeString() : array<int, array<string, string|int|array<string|int, int>>>
- Creates an array of tokens when given some PHP code.
- collectWhitespace() : array<string, string|int>|null
- Collect consecutive whitespace into a single token.
- processLine() : array<int, array<string, string|int>>
- Process a single line of a comment.
Methods
tokenizeString()
Creates an array of tokens when given some PHP code.
public
tokenizeString(string $string, string $eolChar, int $stackPtr) : array<int, array<string, string|int|array<string|int, int>>>
Starts by using token_get_all() but does a lot of extra processing to insert information about the context of the token.
Parameters
- $string : string
-
The string to tokenize.
- $eolChar : string
-
The EOL character to use for splitting strings.
- $stackPtr : int
-
The position of the first token in the file.
Return values
array<int, array<string, string|int|array<string|int, int>>>collectWhitespace()
Collect consecutive whitespace into a single token.
private
collectWhitespace(string $string, int $start, int $end) : array<string, string|int>|null
Parameters
- $string : string
-
The comment string being tokenized.
- $start : int
-
The position in the string to start processing.
- $end : int
-
The position in the string to end processing.
Return values
array<string, string|int>|nullprocessLine()
Process a single line of a comment.
private
processLine(string $string, string $eolChar, int $start, int $end) : array<int, array<string, string|int>>
Parameters
- $string : string
-
The comment string being tokenized.
- $eolChar : string
-
The EOL character to use for splitting strings.
- $start : int
-
The position in the string to start processing.
- $end : int
-
The position in the string to end processing.