protected function Twig_Profiler_NodeVisitor_Profiler::doLeaveNode in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php \Twig_Profiler_NodeVisitor_Profiler::doLeaveNode()
Called after child nodes are visited.
Parameters
Twig_Node $node The node to visit:
Twig_Environment $env The Twig environment instance:
Return value
Twig_Node|false The modified node or false if the node must be removed
Overrides Twig_BaseNodeVisitor::doLeaveNode
File
- vendor/
twig/ twig/ lib/ Twig/ Profiler/ NodeVisitor/ Profiler.php, line 35
Class
- Twig_Profiler_NodeVisitor_Profiler
- @author Fabien Potencier <fabien@symfony.com>
Code
protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) {
if ($node instanceof Twig_Node_Module) {
$varName = $this
->getVarName();
$node
->setNode('display_start', new Twig_Node(array(
new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::TEMPLATE, $node
->getAttribute('filename'), $varName),
$node
->getNode('display_start'),
)));
$node
->setNode('display_end', new Twig_Node(array(
new Twig_Profiler_Node_LeaveProfile($varName),
$node
->getNode('display_end'),
)));
}
elseif ($node instanceof Twig_Node_Block) {
$varName = $this
->getVarName();
$node
->setNode('body', new Twig_Node_Body(array(
new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::BLOCK, $node
->getAttribute('name'), $varName),
$node
->getNode('body'),
new Twig_Profiler_Node_LeaveProfile($varName),
)));
}
elseif ($node instanceof Twig_Node_Macro) {
$varName = $this
->getVarName();
$node
->setNode('body', new Twig_Node_Body(array(
new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::MACRO, $node
->getAttribute('name'), $varName),
$node
->getNode('body'),
new Twig_Profiler_Node_LeaveProfile($varName),
)));
}
return $node;
}