PHP Class Twig_NodeVisitor_Optimizer, php-framework-benchmarks

This visitor is always the last registered one. You can configure which optimizations you want to activate via the optimizer mode.
Author: Fabien Potencier ([email protected])
Inheritance: implements Twig_NodeVisitorInterface
Datei anzeigen Open project: pmjones/php-framework-benchmarks

Protected Properties

Property Type Description
$loops
$optimizers

Public Methods

Method Description
__construct ( integer $optimizers ) Constructor.
enterNode ( Twig_NodeInterface $node, Twig_Environment $env )
getPriority ( )
leaveNode ( Twig_NodeInterface $node, Twig_Environment $env )

Protected Methods

Method Description
enterOptimizeFor ( $node, $env ) Optimizes "for" tag.
leaveOptimizeFor ( $node, $env )

Method Details

__construct() public method

Constructor.
public __construct ( integer $optimizers )
$optimizers integer The optimizer mode

enterNode() public method

public enterNode ( Twig_NodeInterface $node, Twig_Environment $env )
$node Twig_NodeInterface
$env Twig_Environment

enterOptimizeFor() protected method

This method removes the creation of the "loop" variable when: * "loop" is not used in the "for" tag * and there is no include tag without the "only" attribute * and there is inner-for tag (in which case we would need to check parent.loop usage) This method should be able to optimize for with inner-for tags.
protected enterOptimizeFor ( $node, $env )

getPriority() public method

public getPriority ( )

leaveNode() public method

public leaveNode ( Twig_NodeInterface $node, Twig_Environment $env )
$node Twig_NodeInterface
$env Twig_Environment

leaveOptimizeFor() protected method

protected leaveOptimizeFor ( $node, $env )

Property Details

$loops protected_oe property

protected $loops

$optimizers protected_oe property

protected $optimizers