Twig_Compiler

Extends\Twig\Compiler

Compiles a node to PHP code.

package

Default

Methods

__construct

__construct(\Twig\Environment $env)
inherited

Arguments

$env

\Twig\Environment

Adds debugging information.

addDebugInfo(\Twig_NodeInterface $node): $this
inherited

Arguments

Response

$this

Appends an indentation to the current PHP code after compilation.

addIndentation(): $this
inherited
deprecated

since 1.27 (to be removed in 2.0).

Response

$this

Compiles a node.

compile(\Twig_NodeInterface $node,integer $indentation): $this
inherited

Arguments

$indentation

integer

The current indentation

Response

$this

getDebugInfo

getDebugInfo()
inherited

Returns the environment instance related to this compiler.

getEnvironment(): \Twig\Environment
inherited

Response

\Twig\Environment

getFilename

getFilename()
inherited
deprecated

since 1.25 (to be removed in 2.0)

Gets the current PHP code after compilation.

getSource(): string
inherited

Response

string

The PHP code

getVarName

getVarName()
inherited

Indents the generated code.

indent(integer $step = 1): $this
inherited

Arguments

$step

integer

The number of indentation to add

Response

$this

Outdents the generated code.

outdent(integer $step = 1): $this
inherited
Throws
\LogicException

When trying to outdent too much so the indentation would become negative

Arguments

$step

integer

The number of indentation to remove

Response

$this

Adds a raw string to the compiled code.

raw(string $string): $this
inherited

Arguments

$string

string

The string

Response

$this

Returns a PHP representation of a given value.

repr(mixed $value): $this
inherited

Arguments

$value

mixed

The value to convert

Response

$this

Adds a quoted string to the compiled code.

string(string $value): $this
inherited

Arguments

$value

string

The string

Response

$this

subcompile

subcompile(\Twig_NodeInterface $node, $raw = true)
inherited

Arguments

$raw

Writes a string to the compiled code by adding indentation.

write(): $this
inherited

Response

$this

Properties

lastLine

lastLine :
inherited

Type(s)

source

source :
inherited

Type(s)

indentation

indentation :
inherited

Type(s)

env

env :
inherited

Type(s)

debugInfo

debugInfo :
inherited

Type(s)

sourceOffset

sourceOffset :
inherited

Type(s)

sourceLine

sourceLine :
inherited

Type(s)

filename

filename :
inherited

Type(s)

varNameSalt

varNameSalt :
inherited

Type(s)