LineStream

FinalYes

Each TypoScript snippet is turned by the tokenizers into a stream of lines. Tokenizers return instances of this class.

Iterate line streams in a foreach loop using getNextLine().

Tags
internal:

Internal tokenizer structure.

Table of Contents

Properties

$currentIndex  : int

Methods

__serialize()  : array<string|int, mixed>
When storing to cache, we only store FE relevant properties and skip irrelevant things. In particular, $currentIndex should always initialize to -1 and does not need to be stored.
__toString()  : string
Create a source string from given token lines. This is used in backend to turn the "full" token streams of lines into strings for output.
append()  : self
Stream creation.
getNext()  : LineInterface|null
Get next line and raise pointer.
getNextLine()  : iterable<string|int, LineInterface>
isEmpty()  : bool
We sometimes create a line stream but don't add lines.
peekNext()  : LineInterface|null
Get next line but do not raise pointer.
reset()  : self
Reset current pointer. Typically, call this before iterating with getNext().

Properties

$currentIndex

protected int $currentIndex = -1

Methods

__serialize()

When storing to cache, we only store FE relevant properties and skip irrelevant things. In particular, $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 token lines. This is used in backend to turn the "full" token streams of lines into strings for output.

public __toString() : string
Return values
string

getNext()

Get next line and raise pointer.

public getNext() : LineInterface|null

Methods getNext(), peekNext() and reset() are an alternative to getNextLine() which allow peek of the next line, which getNextLine() does not. The disadvantage is that these methods create internal state in $this->currentIndex, which getNextLine() does not. Use getNext() iteration only if peekNext() is needed to avoid creating useless state.

Return values
LineInterface|null

isEmpty()

We sometimes create a line stream but don't add lines.

public isEmpty() : bool

This method returns true if lines have been added.

Return values
bool

reset()

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

public reset() : self
Return values
self

        
On this page

Search results