TokensList
class TokensList implements ArrayAccess (View source)
A structure representing a list of tokens.
Properties
array | $tokens | The array of tokens. | |
int | $count | The count of tokens. | |
int | $idx | The index of the next token to be returned. |
Methods
No description
Builds an array of tokens by merging their raw value.
Gets the next token. Skips any irrelevant token (whitespaces and comments).
Gets the next token.
Gets the next token.
Sets an value inside the container.
Gets a value from the container.
Checks if an offset was previously set.
Unsets the value of an offset.
Details
__construct(array $tokens = [], int $count = -1)
static string
build(string|Token[]|TokensList $list)
Builds an array of tokens by merging their raw value.
add(Token $token)
Adds a new token.
Token|null
getNext()
Gets the next token. Skips any irrelevant token (whitespaces and comments).
Token|null
getNextOfType(int $type)
Gets the next token.
Token|null
getNextOfTypeAndValue(int $type, string $value)
Gets the next token.
offsetSet(int $offset, Token $value)
Sets an value inside the container.
Token
offsetGet(int $offset)
Gets a value from the container.
bool
offsetExists(int $offset)
Checks if an offset was previously set.
offsetUnset(int $offset)
Unsets the value of an offset.