Text.php 763 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2009 Fabien Potencier
  6. * (c) 2009 Armin Ronacher
  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. * Represents a text node.
  13. *
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. */
  16. class Twig_Node_Text extends Twig_Node implements Twig_NodeOutputInterface
  17. {
  18. public function __construct($data, $lineno)
  19. {
  20. parent::__construct(array(), array('data' => $data), $lineno);
  21. }
  22. public function compile(Twig_Compiler $compiler)
  23. {
  24. $compiler
  25. ->addDebugInfo($this)
  26. ->write('echo ')
  27. ->string($this->getAttribute('data'))
  28. ->raw(";\n")
  29. ;
  30. }
  31. }