Sameas.php 708B

12345678910111213141516171819202122232425262728293031
  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. * Checks if a variable is the same as another one (=== in PHP).
  12. *
  13. * @package twig
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. */
  16. class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test
  17. {
  18. public function compile(Twig_Compiler $compiler)
  19. {
  20. $compiler
  21. ->raw('(')
  22. ->subcompile($this->getNode('node'))
  23. ->raw(' === ')
  24. ->subcompile($this->getNode('arguments')->getNode(0))
  25. ->raw(')')
  26. ;
  27. }
  28. }