Twig API
Class

Twig_Node_For

class Twig_Node_For extends Twig_Node

Represents a for node.

Methods

__construct(Twig_Node_Expression_AssignName $keyTarget, Twig_Node_Expression_AssignName $valueTarget, Twig_Node_Expression $seq, Twig_Node_Expression $ifexpr = null, Twig_NodeInterface $body, Twig_NodeInterface $else = null, integer $lineno, string $tag = null)

Constructor.

__toString()

from Twig_Node
toXml($asDom = false)

from Twig_Node
compile(Twig_Compiler $compiler)

Compiles the node to PHP.

getLine()

from Twig_Node
getNodeTag()

from Twig_Node
Boolean hasAttribute(string $name)

Returns true if the attribute is defined.

from Twig_Node
mixed getAttribute(string $name)

Gets an attribute.

from Twig_Node
setAttribute(string $name, mixed $value)

Sets an attribute.

from Twig_Node
removeAttribute(string $name)

Removes an attribute.

from Twig_Node
Boolean hasNode(string $name)

Returns true if the node with the given identifier exists.

from Twig_Node
Twig_Node getNode(string $name)

Gets a node by name.

from Twig_Node
setNode(string $name, Twig_Node $node = null)

Sets a node.

from Twig_Node
removeNode(string $name)

Removes a node by name.

from Twig_Node
count()

from Twig_Node
getIterator()

from Twig_Node

Details

at line 22
public __construct(Twig_Node_Expression_AssignName $keyTarget, Twig_Node_Expression_AssignName $valueTarget, Twig_Node_Expression $seq, Twig_Node_Expression $ifexpr = null, Twig_NodeInterface $body, Twig_NodeInterface $else = null, integer $lineno, string $tag = null)

Constructor.

The nodes are automatically made available as properties ($this->node). The attributes are automatically made available as array items ($this['name']).

Parameters

Twig_Node_Expression_AssignName $keyTarget
Twig_Node_Expression_AssignName $valueTarget
Twig_Node_Expression $seq
Twig_Node_Expression $ifexpr
Twig_NodeInterface $body
Twig_NodeInterface $else
integer $lineno The line number
string $tag The tag name associated with the Node

in Twig_Node at line 44
public __toString()

in Twig_Node at line 72
public toXml($asDom = false)

Parameters

$asDom

at line 38
public compile(Twig_Compiler $compiler)

Compiles the node to PHP.

Parameters

Twig_Compiler $compiler A Twig_Compiler instance

in Twig_Node at line 109
public getLine()

in Twig_Node at line 114
public getNodeTag()

in Twig_Node at line 126
public Boolean hasAttribute(string $name)

Returns true if the attribute is defined.

Parameters

string $name The attribute name

Return Value

Boolean true if the attribute is defined, false otherwise

in Twig_Node at line 138
public mixed getAttribute(string $name)

Gets an attribute.

Parameters

string $name The attribute name

Return Value

mixed The attribute value

in Twig_Node at line 153
public setAttribute(string $name, mixed $value)

Sets an attribute.

Parameters

string $name The attribute name
mixed $value The attribute value

in Twig_Node at line 163
public removeAttribute(string $name)

Removes an attribute.

Parameters

string $name The attribute name

in Twig_Node at line 175
public Boolean hasNode(string $name)

Returns true if the node with the given identifier exists.

Parameters

string $name The node name

Return Value

Boolean true if the node with the given name exists, false otherwise

in Twig_Node at line 187
public Twig_Node getNode(string $name)

Gets a node by name.

Parameters

string $name The node name

Return Value

Twig_Node A Twig_Node instance

in Twig_Node at line 202
public setNode(string $name, Twig_Node $node = null)

Sets a node.

Parameters

string $name The node name
Twig_Node $node A Twig_Node instance

in Twig_Node at line 212
public removeNode(string $name)

Removes a node by name.

Parameters

string $name The node name

in Twig_Node at line 217
public count()

in Twig_Node at line 222
public getIterator()