Twig_TokenStream

Extends\Twig\TokenStream

Represents a token stream.

package

Default

Methods

__construct

__construct(array $tokens,string|null $name = null,string|null $source = null)
inherited

Arguments

$tokens

array

An array of tokens

$name

string|null

The name of the template which tokens are associated with

$source

string|null

The source code associated with the tokens

__toString

__toString()
inherited

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

expect( $type, $value = null, $message = null): \Twig\Token
inherited

Arguments

$type

$value

$message

Response

\Twig\Token

getCurrent

getCurrent(): \Twig\Token
inherited

Response

\Twig\Token

Gets the name associated with this stream (null if not defined).

getFilename(): string|null
inherited
deprecated

since 1.27 (to be removed in 2.0)

Response

string|null

injectTokens

injectTokens(array $tokens)
inherited

Arguments

$tokens

array

Checks if end of stream was reached.

isEOF(): boolean
inherited

Response

boolean

Looks at the next token.

look(integer $number = 1): \Twig\Token
inherited

Arguments

$number

integer

Response

\Twig\Token

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

next(): \Twig\Token
inherited

Response

\Twig\Token

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

nextIf( $primary, $secondary = null): \Twig\Token|null
inherited

Arguments

$primary

$secondary

Response

\Twig\Token|null

The next token if the condition is true, null otherwise

Tests the current token.

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

Arguments

$primary

$secondary

Response

boolean

Properties

tokens

tokens :
inherited

Type(s)

current

current :
inherited

Type(s)

filename

filename :
inherited

Type(s)

source

source :
inherited

Type(s)