Class Twig_Node

SubclassesTwig_Node_AutoEscape, Twig_Node_Block, Twig_Node_BlockReference, Twig_Node_Body, Twig_Node_CheckSecurity, Twig_Node_Do, Twig_Node_Embed, Twig_Node_Expression, Twig_Node_Expression_Array, Twig_Node_Expression_AssignName, Twig_Node_Expression_Binary, Twig_Node_Expression_Binary_Add, Twig_Node_Expression_Binary_And, Twig_Node_Expression_Binary_BitwiseAnd, Twig_Node_Expression_Binary_BitwiseOr, Twig_Node_Expression_Binary_BitwiseXor, Twig_Node_Expression_Binary_Concat, Twig_Node_Expression_Binary_Div, Twig_Node_Expression_Binary_EndsWith, Twig_Node_Expression_Binary_Equal, Twig_Node_Expression_Binary_FloorDiv, Twig_Node_Expression_Binary_Greater, Twig_Node_Expression_Binary_GreaterEqual, Twig_Node_Expression_Binary_In, Twig_Node_Expression_Binary_Less, Twig_Node_Expression_Binary_LessEqual, Twig_Node_Expression_Binary_Matches, Twig_Node_Expression_Binary_Mod, Twig_Node_Expression_Binary_Mul, Twig_Node_Expression_Binary_NotEqual, Twig_Node_Expression_Binary_NotIn, Twig_Node_Expression_Binary_Or, Twig_Node_Expression_Binary_Power, Twig_Node_Expression_Binary_Range, Twig_Node_Expression_Binary_StartsWith, Twig_Node_Expression_Binary_Sub, Twig_Node_Expression_BlockReference, Twig_Node_Expression_Call, Twig_Node_Expression_Conditional, Twig_Node_Expression_Constant, Twig_Node_Expression_ExtensionReference, Twig_Node_Expression_Filter, Twig_Node_Expression_Filter_Default, Twig_Node_Expression_Function, Twig_Node_Expression_GetAttr, Twig_Node_Expression_MethodCall, Twig_Node_Expression_Name, Twig_Node_Expression_NullCoalesce, Twig_Node_Expression_Parent, Twig_Node_Expression_TempName, Twig_Node_Expression_Test, Twig_Node_Expression_Unary, Twig_Node_Expression_Unary_Neg, Twig_Node_Expression_Unary_Not, Twig_Node_Expression_Unary_Pos, Twig_Node_Flush, Twig_Node_For, Twig_Node_ForLoop, Twig_Node_If, Twig_Node_Import, Twig_Node_Include, Twig_Node_Macro, Twig_Node_Module, Twig_Node_Print, Twig_Node_Sandbox, Twig_Node_SandboxedPrint, Twig_Node_Set, Twig_Node_SetTemp, Twig_Node_Spaceless, Twig_Node_Text, Twig_Profiler_Node_EnterProfile, Twig_Profiler_Node_LeaveProfile

Represents a node in the AST.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$attributes Twig_Node
$lineno Twig_Node
$nodes Twig_Node
$tag Twig_Node

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. Twig_Node
__toString() Twig_Node
compile() Twig_Node
count() Twig_Node
getAttribute() Gets an attribute value by name. Twig_Node
getFilename() Twig_Node
getIterator() Twig_Node
getLine() Twig_Node
getNode() Gets a node by name. Twig_Node
getNodeTag() Twig_Node
hasAttribute() Returns true if the attribute is defined. Twig_Node
hasNode() Returns true if the node with the given name exists. Twig_Node
removeAttribute() Removes an attribute by name. Twig_Node
removeNode() Removes a node by name. Twig_Node
setAttribute() Sets an attribute by name to a value. Twig_Node
setFilename() Twig_Node
setNode() Sets a node. Twig_Node
toXml() Twig_Node

Property Details

$attributes protected property
protected $attributes null
$lineno protected property
protected $lineno null
$nodes protected property
protected $nodes null
$tag protected property
protected $tag null

Method Details

__construct() public method


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

public void __construct ( array $nodes = [], array $attributes = [], $lineno 0, $tag null )
$nodes array

An array of named nodes

$attributes array

An array of attributes (should not be nodes)

$lineno int

The line number

$tag string

The tag name associated with the Node

__toString() public method

public void __toString ( )
compile() public method

public void compile ( Twig_Compiler $compiler )
count() public method

public void count ( )
getAttribute() public method

Gets an attribute value by name.

public mixed getAttribute ( $name )
$name string
getFilename() public method

public void getFilename ( )
getIterator() public method

public void getIterator ( )
getLine() public method

public void getLine ( )
getNode() public method

Gets a node by name.

public Twig_Node getNode ( $name )
$name string
getNodeTag() public method

public void getNodeTag ( )
hasAttribute() public method

Returns true if the attribute is defined.

public bool hasAttribute ( $name )
$name string

The attribute name

return bool

True if the attribute is defined, false otherwise

hasNode() public method

Returns true if the node with the given name exists.

public bool hasNode ( $name )
$name string
removeAttribute() public method

Removes an attribute by name.

public void removeAttribute ( $name )
$name string
removeNode() public method

Removes a node by name.

public void removeNode ( $name )
$name string
setAttribute() public method

Sets an attribute by name to a value.

public void setAttribute ( $name, $value )
$name string
$value mixed
setFilename() public method

public void setFilename ( $filename )
setNode() public method

Sets a node.

public void setNode ( $name, $node null )
$name string
$node Twig_Node
toXml() public method

public void toXml ( $asDom false )