ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
52class_alias('Twig_BaseNodeVisitor', 'Twig\NodeVisitor\AbstractNodeVisitor', false);
53class_exists('Twig_Environment');
54class_exists('Twig_Node');
$env
An exception for terminatinating execution or to throw for unit testing.
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.
doEnterNode(Twig_Node $node, Twig_Environment $env)
Called before child nodes are visited.
enterNode(Twig_NodeInterface $node, Twig_Environment $env)
Called before child nodes are visited.
leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
Called after child nodes are visited.
Stores the Twig configuration.
Definition: Environment.php:18
Represents a node in the AST.
Definition: Node.php:19
Represents a node in the AST.
Twig_NodeVisitorInterface is the interface the all node visitor classes must implement.