vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php line 32

  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Bridge\Twig\TokenParser;
  11. use Symfony\Bridge\Twig\Node\TransDefaultDomainNode;
  12. use Twig\Node\Node;
  13. use Twig\Token;
  14. use Twig\TokenParser\AbstractTokenParser;
  15. /**
  16.  * Token Parser for the 'trans_default_domain' tag.
  17.  *
  18.  * @author Fabien Potencier <fabien@symfony.com>
  19.  */
  20. final class TransDefaultDomainTokenParser extends AbstractTokenParser
  21. {
  22.     public function parse(Token $token): Node
  23.     {
  24.         $expr $this->parser->getExpressionParser()->parseExpression();
  25.         $this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
  26.         return new TransDefaultDomainNode($expr$token->getLine(), $this->getTag());
  27.     }
  28.     public function getTag(): string
  29.     {
  30.         return 'trans_default_domain';
  31.     }
  32. }