PEEL Shopping
Open source ecommerce : PEEL Shopping
Filter.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) 2009 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 {
30  public function parse(Twig_Token $token)
31  {
32  $name = $this->parser->getVarName();
33  $ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token->getLine()), true, $token->getLine(), $this->getTag());
34 
35  $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag());
36  $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
37 
38  $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
39  $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
40 
41  $block = new Twig_Node_Block($name, $body, $token->getLine());
42  $this->parser->setBlock($name, $block);
43 
44  return new Twig_Node_Print($filter, $token->getLine(), $this->getTag());
45  }
46 
47  public function decideBlockEnd(Twig_Token $token)
48  {
49  return $token->test('endfilter');
50  }
51 
57  public function getTag()
58  {
59  return 'filter';
60  }
61 }
Represents a block node.
Definition: Block.php:18
Base class for all token parsers.
Definition: TokenParser.php:17
Filters a section of a template by applying filters.
Definition: Filter.php:21
parse(Twig_Token $token)
Parses a token and returns a node.
Definition: Filter.php:30
decideBlockEnd(Twig_Token $token)
Definition: Filter.php:47
const BLOCK_END_TYPE
Definition: Token.php:28
Represents a Token.
Definition: Token.php:18
getLine()
Gets the line.
Definition: Token.php:94
getTag()
Gets the tag name associated with this token parser.
Definition: Filter.php:57
test($type, $values=null)
Tests the current token for a type and/or a value.
Definition: Token.php:75
Represents a block call node.
Represents a node that outputs an expression.
Definition: Print.php:18

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.