\TwigTokenStream

Represents a token stream.

Summary

Methods
Properties
Constants
__construct()
__toString()
injectTokens()
next()
nextIf()
expect()
look()
test()
isEOF()
getCurrent()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$tokens
$current
$source
N/A

Properties

$tokens

$tokens : 

Type

$current

$current : 

Type

$source

$source : 

Type

Methods

__construct()

__construct(array  $tokens, \Twig_Source  $source = null) 

Parameters

array $tokens

An array of tokens

\Twig_Source $source

__toString()

__toString() 

injectTokens()

injectTokens(array  $tokens) 

Parameters

array $tokens

next()

next() : \Twig_Token

Sets the pointer to the next token and returns the old one.

Returns

\Twig_Token

nextIf()

nextIf(  $primary,   $secondary = null) : \Twig_Token|null

Tests a token, sets the pointer to the next one and returns it or throws a syntax error.

Parameters

$primary
$secondary

Returns

\Twig_Token|null —

The next token if the condition is true, null otherwise

expect()

expect(  $type,   $value = null,   $message = null) : \Twig_Token

Tests a token and returns it or throws a syntax error.

Parameters

$type
$value
$message

Returns

\Twig_Token

look()

look(integer  $number = 1) : \Twig_Token

Looks at the next token.

Parameters

integer $number

Returns

\Twig_Token

test()

test(  $primary,   $secondary = null) : boolean

Tests the current token.

Parameters

$primary
$secondary

Returns

boolean

isEOF()

isEOF() : boolean

Checks if end of stream was reached.

Returns

boolean

getCurrent()

getCurrent() : \Twig_Token

Returns

\Twig_Token