Files
wy/ZeedFramework/library/Twig/NodeVisitor/VariableAnalyzer.php
2026-01-07 11:40:41 +08:00

48 lines
972 B
PHP

<?php
/*
* This file is part of Twig.
*
* (c) 2012 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Twig_NodeVisitor_VariableAnalyzer references all variables used in a template.
*
* @package twig
* @author Fabien Potencier <fabien@symfony.com>
*/
class Twig_NodeVisitor_VariableAnalyzer implements Twig_NodeVisitorInterface
{
/**
* {@inheritdoc}
*/
public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
{
if ($node instanceof Twig_Node_Expression_Name) {
print $node->getAttribute('name')."\n";
}
return $node;
}
/**
* {@inheritdoc}
*/
public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
{
return $node;
}
/**
* {@inheritdoc}
*/
public function getPriority()
{
return 0;
}
}