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;
27  if (!$stream->test(Twig_Token::BLOCK_END_TYPE)) {
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 
52 class_alias('Twig_TokenParser_With', 'Twig\TokenParser\WithTokenParser', false);
decideWithEnd(Twig_Token $token)
Definition: With.php:41
parse(Twig_Token $token)
Parses a token and returns a node.
Definition: With.php:21
test($type, $values=null)
Tests the current token for a type and/or a value.
Definition: Token.php:70
$stream
PHP stream implementation.
Base class for all token parsers.
Definition: TokenParser.php:17
Creates a nested scope.
Definition: With.php:19
Create styles array
The data for the language used.
getTag()
Gets the tag name associated with this token parser.
Definition: With.php:46
getLine()
Definition: Token.php:87
const NAME_TYPE
Definition: Token.php:32
Represents a nested "with" scope.
Definition: With.php:17
const BLOCK_END_TYPE
Definition: Token.php:30