JavascriptsTokenParser.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.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\Bundle\CompatAssetsBundle\Twig\TokenParser;
  11. use Symfony\Bundle\CompatAssetsBundle\Twig\Node\JavascriptsNode;
  12. /**
  13. *
  14. *
  15. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  16. */
  17. class JavascriptsTokenParser extends \Twig_TokenParser
  18. {
  19. /**
  20. * Parses a token and returns a node.
  21. *
  22. * @param \Twig_Token $token A \Twig_Token instance
  23. *
  24. * @return \Twig_NodeInterface A \Twig_NodeInterface instance
  25. */
  26. public function parse(\Twig_Token $token)
  27. {
  28. $this->parser->getStream()->expect(\Twig_Token::BLOCK_END_TYPE);
  29. return new JavascriptsNode($token->getLine(), $this->getTag());
  30. }
  31. /**
  32. * Gets the tag name associated with this token parser.
  33. *
  34. * @param string The tag name
  35. */
  36. public function getTag()
  37. {
  38. return 'javascripts';
  39. }
  40. }