PEEL Shopping
Open source ecommerce : PEEL Shopping
Default.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) 2011 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 
22 {
23  public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null)
24  {
25  $default = new Twig_Node_Expression_Filter($node, new Twig_Node_Expression_Constant('default', $node->getLine()), $arguments, $node->getLine());
26 
27  if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr)) {
28  $test = new Twig_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_Node(), $node->getLine());
29  $false = count($arguments) ? $arguments->getNode(0) : new Twig_Node_Expression_Constant('', $node->getLine());
30 
31  $node = new Twig_Node_Expression_Conditional($test, $default, $false, $node->getLine());
32  } else {
33  $node = $default;
34  }
35 
36  parent::__construct($node, $filterName, $arguments, $lineno, $tag);
37  }
38 
39  public function compile(Twig_Compiler $compiler)
40  {
41  $compiler->subcompile($this->getNode('node'));
42  }
43 }
getLine()
Definition: Node.php:109
compile(Twig_Compiler $compiler)
Compiles the node to PHP.
Definition: Default.php:39
Compiles a node to PHP code.
Definition: Compiler.php:18
Returns the value or the default value when it is undefined or empty.
Definition: Default.php:21
Represents a node in the AST.
Definition: Node.php:18
getAttribute($name)
Gets an attribute.
Definition: Node.php:138
$lineno
Definition: Node.php:22
subcompile(Twig_NodeInterface $node, $raw=true)
Definition: Compiler.php:91
Checks if a variable is defined in the current context.
Definition: Defined.php:24
Represents a node in the AST.
__construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag=null)
Definition: Default.php:23
count()
Definition: Node.php:217
getNode($name)
Gets a node by name.
Definition: Node.php:187

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:18 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.