Flush.php 905B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2011 Fabien Potencier
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * Flushes the output to the client.
  12. *
  13. * @see flush()
  14. */
  15. class Twig_TokenParser_Flush extends Twig_TokenParser
  16. {
  17. /**
  18. * Parses a token and returns a node.
  19. *
  20. * @param Twig_Token $token A Twig_Token instance
  21. *
  22. * @return Twig_NodeInterface A Twig_NodeInterface instance
  23. */
  24. public function parse(Twig_Token $token)
  25. {
  26. $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
  27. return new Twig_Node_Flush($token->getLine(), $this->getTag());
  28. }
  29. /**
  30. * Gets the tag name associated with this token parser.
  31. *
  32. * @return string The tag name
  33. */
  34. public function getTag()
  35. {
  36. return 'flush';
  37. }
  38. }