Unary.php 754B

12345678910111213141516171819202122232425262728293031
  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. abstract class Twig_Node_Expression_Unary extends Twig_Node_Expression
  12. {
  13. public function __construct(Twig_NodeInterface $node, $lineno)
  14. {
  15. parent::__construct(array('node' => $node), array(), $lineno);
  16. }
  17. public function compile(Twig_Compiler $compiler)
  18. {
  19. $compiler->raw('(');
  20. $this->operator($compiler);
  21. $compiler
  22. ->subcompile($this->getNode('node'))
  23. ->raw(')')
  24. ;
  25. }
  26. abstract public function operator(Twig_Compiler $compiler);
  27. }