ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
With.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of Twig.
5 *
6 * (c) 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
20{
21 public function parse(Twig_Token $token)
22 {
23 $stream = $this->parser->getStream();
24
25 $variables = null;
26 $only = false;
28 $variables = $this->parser->getExpressionParser()->parseExpression();
29 $only = $stream->nextIf(Twig_Token::NAME_TYPE, 'only');
30 }
31
33
34 $body = $this->parser->subparse(array($this, 'decideWithEnd'), true);
35
37
38 return new Twig_Node_With($body, $variables, $only, $token->getLine(), $this->getTag());
39 }
40
41 public function decideWithEnd(Twig_Token $token)
42 {
43 return $token->test('endwith');
44 }
45
46 public function getTag()
47 {
48 return 'with';
49 }
50}
51
52class_alias('Twig_TokenParser_With', 'Twig\TokenParser\WithTokenParser', false);
An exception for terminatinating execution or to throw for unit testing.
Represents a nested "with" scope.
Definition: With.php:18
Creates a nested scope.
Definition: With.php:20
decideWithEnd(Twig_Token $token)
Definition: With.php:41
parse(Twig_Token $token)
Parses a token and returns a node.
Definition: With.php:21
getTag()
Gets the tag name associated with this token parser.
Definition: With.php:46
Base class for all token parsers.
Definition: TokenParser.php:18
Represents a Token.
Definition: Token.php:21
const BLOCK_END_TYPE
Definition: Token.php:30
getLine()
Definition: Token.php:87
test($type, $values=null)
Tests the current token for a type and/or a value.
Definition: Token.php:70
const NAME_TYPE
Definition: Token.php:32
$stream
PHP stream implementation.