ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Twig_BaseNodeVisitor Class Reference

Twig_BaseNodeVisitor can be used to make node visitors compatible with Twig 1.x and 2.x. More...

+ Inheritance diagram for Twig_BaseNodeVisitor:
+ Collaboration diagram for Twig_BaseNodeVisitor:

Public Member Functions

 enterNode (Twig_NodeInterface $node, Twig_Environment $env)
 Called before child nodes are visited. More...
 
 leaveNode (Twig_NodeInterface $node, Twig_Environment $env)
 Called after child nodes are visited. More...
 
- Public Member Functions inherited from Twig_NodeVisitorInterface
 getPriority ()
 Returns the priority for this visitor. More...
 

Protected Member Functions

 doEnterNode (Twig_Node $node, Twig_Environment $env)
 Called before child nodes are visited. More...
 
 doLeaveNode (Twig_Node $node, Twig_Environment $env)
 Called after child nodes are visited. More...
 

Detailed Description

Twig_BaseNodeVisitor can be used to make node visitors compatible with Twig 1.x and 2.x.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 17 of file BaseNodeVisitor.php.

Member Function Documentation

◆ doEnterNode()

Twig_BaseNodeVisitor::doEnterNode ( Twig_Node  $node,
Twig_Environment  $env 
)
abstractprotected

Called before child nodes are visited.

Returns
Twig_Node The modified node

Referenced by enterNode(), and leaveNode().

+ Here is the caller graph for this function:

◆ doLeaveNode()

Twig_BaseNodeVisitor::doLeaveNode ( Twig_Node  $node,
Twig_Environment  $env 
)
abstractprotected

Called after child nodes are visited.

Returns
Twig_Node|false The modified node or false if the node must be removed

Referenced by leaveNode().

+ Here is the caller graph for this function:

◆ enterNode()

Twig_BaseNodeVisitor::enterNode ( Twig_NodeInterface  $node,
Twig_Environment  $env 
)
final

Called before child nodes are visited.

Returns
Twig_NodeInterface The modified node

Implements Twig_NodeVisitorInterface.

Definition at line 19 of file BaseNodeVisitor.php.

References doEnterNode().

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  }
Represents a node in the AST.
Definition: Node.php:18
doEnterNode(Twig_Node $node, Twig_Environment $env)
Called before child nodes are visited.
+ Here is the call graph for this function:

◆ leaveNode()

Twig_BaseNodeVisitor::leaveNode ( Twig_NodeInterface  $node,
Twig_Environment  $env 
)
final

Called after child nodes are visited.

Returns
Twig_NodeInterface|false The modified node or false if the node must be removed

Implements Twig_NodeVisitorInterface.

Definition at line 28 of file BaseNodeVisitor.php.

References $env, doEnterNode(), and doLeaveNode().

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  }
Represents a node in the AST.
Definition: Node.php:18
doLeaveNode(Twig_Node $node, Twig_Environment $env)
Called after child nodes are visited.
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: