Power.php 764B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2010 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. class Twig_Node_Expression_Binary_Power extends Twig_Node_Expression_Binary
  11. {
  12. /**
  13. * Compiles the node to PHP.
  14. *
  15. * @param Twig_Compiler A Twig_Compiler instance
  16. */
  17. public function compile(Twig_Compiler $compiler)
  18. {
  19. $compiler
  20. ->raw('pow(')
  21. ->subcompile($this->getNode('left'))
  22. ->raw(', ')
  23. ->subcompile($this->getNode('right'))
  24. ->raw(')')
  25. ;
  26. }
  27. public function operator(Twig_Compiler $compiler)
  28. {
  29. return $compiler->raw('**');
  30. }
  31. }