[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/phpbb/template/twig/tokenparser/ -> includephp.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher
   8  * @license GNU General Public License, version 2 (GPL-2.0)
   9  *
  10  * For full copyright and license information, please see
  11  * the docs/CREDITS.txt file.
  12  *
  13  */
  14  
  15  namespace phpbb\template\twig\tokenparser;
  16  
  17  class includephp extends \Twig\TokenParser\AbstractTokenParser
  18  {
  19      /** @var \phpbb\template\twig\environment */
  20      protected $environment;
  21  
  22      /**
  23      * Constructor
  24      *
  25      * @param \phpbb\template\twig\environment $environment
  26      */
  27  	public function __construct(\phpbb\template\twig\environment $environment)
  28      {
  29          $this->environment = $environment;
  30      }
  31  
  32      /**
  33      * Parses a token and returns a node.
  34      *
  35      * @param \Twig\Token $token A Twig\Token instance
  36      *
  37      * @return \Twig\Node\Node A Twig\Node instance
  38      */
  39  	public function parse(\Twig\Token $token)
  40      {
  41          $expr = $this->parser->getExpressionParser()->parseExpression();
  42  
  43          $stream = $this->parser->getStream();
  44  
  45          $ignoreMissing = false;
  46          if ($stream->test(\Twig\Token::NAME_TYPE, 'ignore'))
  47          {
  48              $stream->next();
  49              $stream->expect(\Twig\Token::NAME_TYPE, 'missing');
  50  
  51              $ignoreMissing = true;
  52          }
  53  
  54          $stream->expect(\Twig\Token::BLOCK_END_TYPE);
  55  
  56          return new \phpbb\template\twig\node\includephp($expr, $this->environment, $token->getLine(), $ignoreMissing, $this->getTag());
  57      }
  58  
  59      /**
  60      * Gets the tag name associated with this token parser.
  61      *
  62      * @return string The tag name
  63      */
  64  	public function getTag()
  65      {
  66          return 'INCLUDEPHP';
  67      }
  68  }


Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1