LineStream
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
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
stringappend()
Stream creation.
public
append(LineInterface $line) : self
Parameters
- $line : LineInterface
Return values
selfgetNext()
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|nullgetNextLine()
public
getNextLine() : iterable<string|int, LineInterface>
Return values
iterable<string|int, LineInterface>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
boolpeekNext()
Get next line but do not raise pointer.
public
peekNext() : LineInterface|null
Return values
LineInterface|nullreset()
Reset current pointer. Typically, call this before iterating with getNext().
public
reset() : self