AbstractTokenStream implements TokenStreamInterface

AbstractYes

A generic implementation of TokenStreamInterface.

Tags
internal:

Internal tokenizer structure.

Table of Contents

Interfaces

TokenStreamInterface
A generic stream of tokens used in single LineInterface lines.

Properties

$currentIndex  : int
$tokens  : array<string|int, TokenInterface>

Methods

__serialize()  : array<string|int, mixed>
When storing to cache, we only store FE relevant properties and skip irrelevant things. For instance $currentIndex should always initialize to -1 and does not need to be stored.
__toString()  : string
Create a source string from given tokens.
append()  : self
Stream creation.
getAll()  : array<string|int, TokenInterface>
Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.
getNext()  : TokenInterface|null
Get next token and raise pointer.
isEmpty()  : bool
We sometimes create a stream but don't add tokens.
peekNext()  : TokenInterface|null
Get next token but do not raise pointer.
reset()  : static
Reset current pointer. Typically, call this before iterating with getNext().
setAll()  : self
Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.
serialize()  : array<string|int, mixed>

Properties

$currentIndex

protected int $currentIndex = -1

Methods

__serialize()

When storing to cache, we only store FE relevant properties and skip irrelevant things. For instance $currentIndex should always initialize to -1 and does not need to be stored.

public final __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__toString()

Create a source string from given tokens.

public __toString() : string
Return values
string

getAll()

Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.

public getAll() : array<string|int, TokenInterface>
Return values
array<string|int, TokenInterface>

isEmpty()

We sometimes create a stream but don't add tokens.

public isEmpty() : bool

This method returns true if tokens have been added.

Return values
bool

reset()

Reset current pointer. Typically, call this before iterating with getNext().

public reset() : static
Return values
static

setAll()

Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.

public setAll(array<string|int, mixed> $tokens) : self
Parameters
$tokens : array<string|int, mixed>
Return values
self

serialize()

protected serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results