You are here

public function Twig_Node_For::__construct in Translation template extractor 7.3

Same name and namespace in other branches
  1. 6.3 vendor/Twig/Node/For.php \Twig_Node_For::__construct()

Constructor.

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

Parameters

array $nodes An array of named nodes:

array $attributes An array of attributes (should not be nodes):

int $lineno The line number:

string $tag The tag name associated with the Node:

Overrides Twig_Node::__construct

File

vendor/Twig/Node/For.php, line 22

Class

Twig_Node_For
Represents a for node.

Code

public function __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, $lineno, $tag = null) {
  $body = new Twig_Node(array(
    $body,
    $this->loop = new Twig_Node_ForLoop($lineno, $tag),
  ));
  if (null !== $ifexpr) {
    $body = new Twig_Node_If(new Twig_Node(array(
      $ifexpr,
      $body,
    )), null, $lineno, $tag);
  }
  parent::__construct(array(
    'key_target' => $keyTarget,
    'value_target' => $valueTarget,
    'seq' => $seq,
    'body' => $body,
    'else' => $else,
  ), array(
    'with_loop' => true,
    'ifexpr' => null !== $ifexpr,
  ), $lineno, $tag);
}