class TokenIterator extends Object

internal  
 

Traversing helper.

Properties

array $tokens
int $position
array $ignored

Methods

__construct(array $tokens)

No description

array|null
currentToken()

Returns current token.

string|null
currentValue()

Returns current token value.

array|null
nextToken()

Returns next token.

string|null
nextValue()

Returns next token value.

array[]
nextAll()

Returns all next tokens.

array[]
nextUntil($arg)

Returns all next tokens until it sees a given token type or value.

string
joinAll()

Returns concatenation of all next token values.

string
joinUntil($arg)

Returns concatenation of all next tokens until it sees a given token type or value.

bool
isCurrent($arg)

Checks the current token.

bool
isNext()

Checks the next token existence.

bool
isPrev()

Checks the previous token existence.

reset()

No description

next()

Moves cursor to next token.

mixed
scan($wanted, $onlyFirst, $advance, $strings = FALSE, $until = FALSE, $prev = FALSE)

Looks for (first) (not) wanted tokens.

Details

at line 32
__construct(array $tokens)

No description

Parameters

array $tokens

at line 42
array|null currentToken()

Returns current token.

Return Value

array|null

at line 54
string|null currentValue()

Returns current token value.

Return Value

string|null

at line 67
array|null nextToken()

Returns next token.

Return Value

array|null

at line 78
string|null nextValue()

Returns next token value.

Return Value

string|null

at line 89
array[] nextAll()

Returns all next tokens.

Return Value

array[]

at line 100
array[] nextUntil($arg)

Returns all next tokens until it sees a given token type or value.

Parameters

$arg

Return Value

array[]

at line 111
string joinAll()

Returns concatenation of all next token values.

Return Value

string

at line 122
string joinUntil($arg)

Returns concatenation of all next tokens until it sees a given token type or value.

Parameters

$arg

Return Value

string

at line 133
bool isCurrent($arg)

Checks the current token.

Parameters

$arg

Return Value

bool

at line 150
bool isNext()

Checks the next token existence.

Return Value

bool

at line 161
bool isPrev()

Checks the previous token existence.

Return Value

bool

at line 170
TokenIterator reset()

No description

Return Value

TokenIterator

at line 180
protected next()

Moves cursor to next token.

at line 196
protected mixed scan($wanted, $onlyFirst, $advance, $strings = FALSE, $until = FALSE, $prev = FALSE)

Looks for (first) (not) wanted tokens.

Parameters

$wanted
$onlyFirst
$advance
$strings
$until
$prev

Return Value

mixed