[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/template/twig/tokenparser/ -> php.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  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\template\twig\tokenparser;
  15  
  16  class php extends \Twig\TokenParser\AbstractTokenParser
  17  {
  18      /** @var \phpbb\template\twig\environment */
  19      protected $environment;
  20  
  21      /**
  22      * Constructor
  23      *
  24      * @param \phpbb\template\twig\environment $environment
  25      */
  26  	public function __construct(\phpbb\template\twig\environment $environment)
  27      {
  28          $this->environment = $environment;
  29      }
  30  
  31      /**
  32      * Parses a token and returns a node.
  33      *
  34      * @param \Twig\Token $token A Twig\Token instance
  35      *
  36      * @return \Twig\Node\Node A Twig\Node instance
  37      */
  38  	public function parse(\Twig\Token $token)
  39      {
  40          $stream = $this->parser->getStream();
  41  
  42          $stream->expect(\Twig\Token::BLOCK_END_TYPE);
  43  
  44          $body = $this->parser->subparse(array($this, 'decideEnd'), true);
  45  
  46          $stream->expect(\Twig\Token::BLOCK_END_TYPE);
  47  
  48          return new \phpbb\template\twig\node\php($body, $this->environment, $token->getLine(), $this->getTag());
  49      }
  50  
  51  	public function decideEnd(\Twig\Token $token)
  52      {
  53          return $token->test('ENDPHP');
  54      }
  55  
  56      /**
  57      * Gets the tag name associated with this token parser.
  58      *
  59      * @return string The tag name
  60      */
  61  	public function getTag()
  62      {
  63          return 'PHP';
  64      }
  65  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1