Twig_Node_Expression_Binary_EndsWith

This file is part of Twig.

Defined (1)

The class is defined in the following location(s).

/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php  
  1. class Twig_Node_Expression_Binary_EndsWith extends Twig_Node_Expression_Binary 
  2. public function compile(Twig_Compiler $compiler) 
  3. $left = $compiler->getVarName(); 
  4. $right = $compiler->getVarName(); 
  5. $compiler 
  6. ->raw(sprintf('(is_string($%s = ', $left)) 
  7. ->subcompile($this->getNode('left')) 
  8. ->raw(sprintf(') && is_string($%s = ', $right)) 
  9. ->subcompile($this->getNode('right')) 
  10. ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right)) 
  11.  
  12. public function operator(Twig_Compiler $compiler) 
  13. return $compiler->raw('');