本文整理匯總了PHP中Twig_Node::getIterator方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twig_Node::getIterator方法的具體用法?PHP Twig_Node::getIterator怎麽用?PHP Twig_Node::getIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Twig_Node
的用法示例。
在下文中一共展示了Twig_Node::getIterator方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getVariables
/**
* 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);
}
}
}
示例2: getKeyValuePairs
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;
}
示例3: __construct
public function __construct(\Twig_Node $node)
{
$this->node = $node;
$this->iterator = $node->getIterator();
}