/** * Find placeholder nodes recursively. * * @param Twig_Node $node * @param array $placeholders */ protected function getVariables($node, &$placeholders) { if ($node instanceof Curry_Twig_Node_Placeholder) { $placeholders[$node->getAttribute('name')] = true; } foreach ($node->getIterator() as $n) { if ($n instanceof Twig_Node) { $this->getVariables($n, $placeholders); } } }
private function getKeyValuePairs(\Twig_Node $node) { $pairs = array(); foreach (array_chunk($node->getIterator()->getArrayCopy(), 2) as $pair) { $pairs[] = array('key' => $pair[0], 'value' => $pair[1]); } return $pairs; }
public function __construct(\Twig_Node $node) { $this->node = $node; $this->iterator = $node->getIterator(); }