ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Twig_TokenParser_With Class Reference

Creates a nested scope. More...

+ Inheritance diagram for Twig_TokenParser_With:
+ Collaboration diagram for Twig_TokenParser_With:

Public Member Functions

 parse (Twig_Token $token)
 Parses a token and returns a node. More...
 
 decideWithEnd (Twig_Token $token)
 
 getTag ()
 Gets the tag name associated with this token parser. More...
 
- Public Member Functions inherited from Twig_TokenParser
 setParser (Twig_Parser $parser)
 Sets the parser associated with this token parser. More...
 

Additional Inherited Members

- Protected Attributes inherited from Twig_TokenParser
 $parser
 

Detailed Description

Creates a nested scope.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 19 of file With.php.

Member Function Documentation

◆ decideWithEnd()

Twig_TokenParser_With::decideWithEnd ( Twig_Token  $token)

Definition at line 41 of file With.php.

References Twig_Token\test().

42  {
43  return $token->test('endwith');
44  }
test($type, $values=null)
Tests the current token for a type and/or a value.
Definition: Token.php:70
+ Here is the call graph for this function:

◆ getTag()

Twig_TokenParser_With::getTag ( )

Gets the tag name associated with this token parser.

Returns
string The tag name

Implements Twig_TokenParserInterface.

Definition at line 46 of file With.php.

Referenced by parse().

47  {
48  return 'with';
49  }
+ Here is the caller graph for this function:

◆ parse()

Twig_TokenParser_With::parse ( Twig_Token  $token)

Parses a token and returns a node.

Returns
Twig_NodeInterface
Exceptions
Twig_Error_Syntax

Implements Twig_TokenParserInterface.

Definition at line 21 of file With.php.

References GuzzleHttp\Psr7\$stream, Twig_Token\BLOCK_END_TYPE, Twig_Token\getLine(), getTag(), and Twig_Token\NAME_TYPE.

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  }
$stream
PHP stream implementation.
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
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: