Documentation

Comment
in package

Table of Contents

tokenizeString()  : array<string|int, mixed>
Creates an array of tokens when given some PHP code.
collectWhitespace()  : array<string|int, mixed>|null
Collect consecutive whitespace into a single token.
processLine()  : array<string|int, mixed>
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<string|int, mixed>

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<string|int, mixed>

collectWhitespace()

Collect consecutive whitespace into a single token.

private collectWhitespace(string $string, int $start, int $end) : array<string|int, mixed>|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|int, mixed>|null

processLine()

Process a single line of a comment.

private processLine(string $string, string $eolChar, int $start, int $end) : array<string|int, mixed>
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.

Return values
array<string|int, mixed>

Search results