ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
BaseNodeVisitor.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) Fabien Potencier
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
18 {
19  final public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
20  {
21  if (!$node instanceof Twig_Node) {
22  throw new LogicException('Twig_BaseNodeVisitor only supports Twig_Node instances.');
23  }
24 
25  return $this->doEnterNode($node, $env);
26  }
27 
28  final public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
29  {
30  if (!$node instanceof Twig_Node) {
31  throw new LogicException('Twig_BaseNodeVisitor only supports Twig_Node instances.');
32  }
33 
34  return $this->doLeaveNode($node, $env);
35  }
36 
42  abstract protected function doEnterNode(Twig_Node $node, Twig_Environment $env);
43 
49  abstract protected function doLeaveNode(Twig_Node $node, Twig_Environment $env);
50 }
51 
52 class_alias('Twig_BaseNodeVisitor', 'Twig\NodeVisitor\AbstractNodeVisitor', false);
53 class_exists('Twig_Environment');
54 class_exists('Twig_Node');
Represents a node in the AST.
leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
Called after child nodes are visited.
Represents a node in the AST.
Definition: Node.php:18
$env
doEnterNode(Twig_Node $node, Twig_Environment $env)
Called before child nodes are visited.
Twig_NodeVisitorInterface is the interface the all node visitor classes must implement.
Twig_BaseNodeVisitor can be used to make node visitors compatible with Twig 1.x and 2...
doLeaveNode(Twig_Node $node, Twig_Environment $env)
Called after child nodes are visited.
enterNode(Twig_NodeInterface $node, Twig_Environment $env)
Called before child nodes are visited.
Stores the Twig configuration.
Definition: Environment.php:17