‪TYPO3CMS  ‪main
TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream Class Reference

Public Member Functions

 __toString ()
 __serialize ()
 append (LineInterface $line)
 isEmpty ()
iterable< LineInterfacegetNextLine ()
 reset ()
 getNext ()
 peekNext ()

Protected Attributes

int $currentIndex = -1

Private Attributes

array $lines = []

Detailed Description

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().

: Internal tokenizer structure.

Definition at line 28 of file LineStream.php.

Member Function Documentation

◆ __serialize()

TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream::__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.

Definition at line 57 of file LineStream.php.

References TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream\$lines.

◆ __toString()

TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream::__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.

Definition at line 40 of file LineStream.php.

References TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream\getNextLine().

◆ append()

TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream::append ( LineInterface  $line)

Stream creation.

Definition at line 67 of file LineStream.php.

◆ getNext()

TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream::getNext ( )

Get next line and raise pointer.

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.

Definition at line 111 of file LineStream.php.

References TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream\$currentIndex.

Referenced by TYPO3\CMS\Core\TypoScript\AST\CommentAwareAstBuilder\build().

◆ getNextLine()

iterable<LineInterface> TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream::getNextLine ( )

Definition at line 85 of file LineStream.php.

Referenced by TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream\__toString(), and TYPO3\CMS\Core\TypoScript\AST\AstBuilder\build().

◆ isEmpty()

TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream::isEmpty ( )

We sometimes create a line stream but don't add lines. This method returns true if lines have been added.

Definition at line 77 of file LineStream.php.

◆ peekNext()

TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream::peekNext ( )

Get next line but do not raise pointer.

Definition at line 120 of file LineStream.php.

Referenced by TYPO3\CMS\Core\TypoScript\AST\CommentAwareAstBuilder\build().

◆ reset()

TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream::reset ( )

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

Definition at line 95 of file LineStream.php.

Member Data Documentation

◆ $currentIndex

int TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream::$currentIndex = -1

◆ $lines

array TYPO3\CMS\Core\TypoScript\Tokenizer\Line\LineStream::$lines = []