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

Includes a template. More...

+ Inheritance diagram for Twig_TokenParser_Include:
+ Collaboration diagram for Twig_TokenParser_Include:

Public Member Functions

 parse (Twig_Token $token)
 Parses a token and returns a node. More...
 
 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...
 
 setParser (Twig_Parser $parser)
 Sets the parser associated with this token parser. More...
 
 parse (Twig_Token $token)
 Parses a token and returns a node. More...
 
 getTag ()
 Gets the tag name associated with this token parser. More...
 

Protected Member Functions

 parseArguments ()
 

Additional Inherited Members

- Protected Attributes inherited from Twig_TokenParser
 $parser
 

Detailed Description

Includes a template.

  {% include 'header.html' %}
    Body
  {% include 'footer.html' %}

Definition at line 22 of file Include.php.

Member Function Documentation

◆ getTag()

Twig_TokenParser_Include::getTag ( )

Gets the tag name associated with this token parser.

Returns
string The tag name

Implements Twig_TokenParserInterface.

Reimplemented in Twig_TokenParser_Embed.

Definition at line 59 of file Include.php.

60 {
61 return 'include';
62 }

◆ parse()

Twig_TokenParser_Include::parse ( Twig_Token  $token)

Parses a token and returns a node.

Returns
Twig_NodeInterface
Exceptions
Twig_Error_Syntax

Implements Twig_TokenParserInterface.

Reimplemented in Twig_TokenParser_Embed.

Definition at line 24 of file Include.php.

25 {
26 $expr = $this->parser->getExpressionParser()->parseExpression();
27
28 list($variables, $only, $ignoreMissing) = $this->parseArguments();
29
30 return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
31 }
Represents an include node.
Definition: Include.php:19

References PHPMailer\PHPMailer\$token, and parseArguments().

+ Here is the call graph for this function:

◆ parseArguments()

Twig_TokenParser_Include::parseArguments ( )
protected

Definition at line 33 of file Include.php.

34 {
35 $stream = $this->parser->getStream();
36
37 $ignoreMissing = false;
38 if ($stream->nextIf(Twig_Token::NAME_TYPE, 'ignore')) {
39 $stream->expect(Twig_Token::NAME_TYPE, 'missing');
40
41 $ignoreMissing = true;
42 }
43
44 $variables = null;
45 if ($stream->nextIf(Twig_Token::NAME_TYPE, 'with')) {
46 $variables = $this->parser->getExpressionParser()->parseExpression();
47 }
48
49 $only = false;
50 if ($stream->nextIf(Twig_Token::NAME_TYPE, 'only')) {
51 $only = true;
52 }
53
55
56 return array($variables, $only, $ignoreMissing);
57 }
const BLOCK_END_TYPE
Definition: Token.php:30
const NAME_TYPE
Definition: Token.php:32
$stream
PHP stream implementation.

References GuzzleHttp\Psr7\$stream, Twig_Token\BLOCK_END_TYPE, and Twig_Token\NAME_TYPE.

Referenced by Twig_TokenParser_Embed\parse(), and parse().

+ Here is the caller graph for this function:

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