22 $node =
new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
23 $node->setAttribute(
'with_loop',
false);
25 $this->assertEquals($keyTarget, $node->getNode(
'key_target'));
26 $this->assertEquals($valueTarget, $node->getNode(
'value_target'));
27 $this->assertEquals($seq, $node->getNode(
'seq'));
28 $this->assertTrue($node->getAttribute(
'ifexpr'));
29 $this->assertEquals(
'Twig_Node_If', get_class($node->getNode(
'body')));
30 $this->assertEquals($body, $node->getNode(
'body')->getNode(
'tests')->getNode(1)->getNode(0));
31 $this->assertFalse($node->hasNode(
'else'));
34 $node =
new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
35 $node->setAttribute(
'with_loop',
false);
36 $this->assertEquals($else, $node->getNode(
'else'));
49 $node =
new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
50 $node->setAttribute(
'with_loop',
false);
59 \$_parent = \$context[
'_parent'];
61 \$context = array_intersect_key(\
$context, \$_parent) + \$_parent;
71 $node =
new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
72 $node->setAttribute(
'with_loop',
true);
77 \$context[
'_seq'] = twig_ensure_traversable({$this->
getVariableGetter(
'values')});
78 \$context[
'loop'] = array(
86 \$context[
'loop'][
'revindex0'] = \$length - 1;
87 \$context[
'loop'][
'revindex'] = \$length;
88 \$context[
'loop'][
'length'] = \$length;
89 \$context[
'loop'][
'last'] = 1 === \$length;
93 ++\$context[
'loop'][
'index0'];
94 ++\$context[
'loop'][
'index'];
95 \$context[
'loop'][
'first'] =
false;
96 if (isset(\
$context[
'loop'][
'length'])) {
97 --\$context[
'loop'][
'revindex0'];
98 --\$context[
'loop'][
'revindex'];
99 \$context[
'loop'][
'last'] = 0 === \$context[
'loop'][
'revindex0'];
102 \$_parent = \$context[
'_parent'];
104 \$context = array_intersect_key(\
$context, \$_parent) + \$_parent;
114 $node =
new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
115 $node->setAttribute(
'with_loop',
true);
120 \$context[
'_seq'] = twig_ensure_traversable({$this->
getVariableGetter(
'values')});
121 \$context[
'loop'] = array(
130 ++\$context[
'loop'][
'index0'];
131 ++\$context[
'loop'][
'index'];
132 \$context[
'loop'][
'first'] =
false;
135 \$_parent = \$context[
'_parent'];
137 \$context = array_intersect_key(\
$context, \$_parent) + \$_parent;
147 $node =
new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
148 $node->setAttribute(
'with_loop',
true);
153 \$context[
'_seq'] = twig_ensure_traversable({$this->
getVariableGetter(
'values')});
154 \$context[
'_iterated'] =
false;
155 \$context[
'loop'] = array(
162 \$length = count(\
$context[
'_seq']);
163 \$context[
'loop'][
'revindex0'] = \$length - 1;
164 \$context[
'loop'][
'revindex'] = \$length;
165 \$context[
'loop'][
'length'] = \$length;
166 \$context[
'loop'][
'last'] = 1 === \$length;
170 \$context[
'_iterated'] =
true;
171 ++\$context[
'loop'][
'index0'];
172 ++\$context[
'loop'][
'index'];
173 \$context[
'loop'][
'first'] =
false;
174 if (isset(\
$context[
'loop'][
'length'])) {
175 --\$context[
'loop'][
'revindex0'];
176 --\$context[
'loop'][
'revindex'];
177 \$context[
'loop'][
'last'] = 0 === \$context[
'loop'][
'revindex0'];
183 \$_parent = \$context[
'_parent'];
185 \$context = array_intersect_key(\
$context, \$_parent) + \$_parent;
Represents a node in the AST.
Represents a node that outputs an expression.
getVariableGetter($name, $line=false)
const EOF
How fgetc() reports an End Of File.