vendor/twig/twig/src/Node/PrintNode.php line 25

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Twig.
  4.  *
  5.  * (c) Fabien Potencier
  6.  * (c) 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. namespace Twig\Node;
  12. use Twig\Compiler;
  13. use Twig\Node\Expression\AbstractExpression;
  14. /**
  15.  * Represents a node that outputs an expression.
  16.  *
  17.  * @author Fabien Potencier <fabien@symfony.com>
  18.  */
  19. class PrintNode extends Node implements NodeOutputInterface
  20. {
  21.     public function __construct(AbstractExpression $exprint $linenostring $tag null)
  22.     {
  23.         parent::__construct(['expr' => $expr], [], $lineno$tag);
  24.     }
  25.     public function compile(Compiler $compiler): void
  26.     {
  27.         $compiler
  28.             ->addDebugInfo($this)
  29.             ->write('echo ')
  30.             ->subcompile($this->getNode('expr'))
  31.             ->raw(";\n")
  32.         ;
  33.     }
  34. }