[ Index ]

PHP Cross Reference of phpBB-3.3.2-deutsch

title

Body

[close]

/vendor/symfony/twig-bridge/TokenParser/ -> DumpTokenParser.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Bridge\Twig\TokenParser;
  13  
  14  use Symfony\Bridge\Twig\Node\DumpNode;
  15  use Twig\Token;
  16  use Twig\TokenParser\AbstractTokenParser;
  17  
  18  /**
  19   * Token Parser for the 'dump' tag.
  20   *
  21   * Dump variables with:
  22   *
  23   *     {% dump %}
  24   *     {% dump foo %}
  25   *     {% dump foo, bar %}
  26   *
  27   * @author Julien Galenski <julien.galenski@gmail.com>
  28   */
  29  class DumpTokenParser extends AbstractTokenParser
  30  {
  31      /**
  32       * {@inheritdoc}
  33       */
  34      public function parse(Token $token)
  35      {
  36          $values = null;
  37          if (!$this->parser->getStream()->test(Token::BLOCK_END_TYPE)) {
  38              $values = $this->parser->getExpressionParser()->parseMultitargetExpression();
  39          }
  40          $this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
  41  
  42          return new DumpNode($this->parser->getVarName(), $values, $token->getLine(), $this->getTag());
  43      }
  44  
  45      /**
  46       * {@inheritdoc}
  47       */
  48      public function getTag()
  49      {
  50          return 'dump';
  51      }
  52  }


Generated: Wed Nov 11 20:28:18 2020 Cross-referenced by PHPXref 0.7.1