[ Index ]

PHP Cross Reference of phpBB-3.3.11-deutsch

title

Body

[close]

/vendor/twig/twig/src/Node/Expression/Binary/ -> EndsWithBinary.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of Twig.
   5   *
   6   * (c) Fabien Potencier
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Twig\Node\Expression\Binary;
  13  
  14  use Twig\Compiler;
  15  
  16  class EndsWithBinary extends AbstractBinary
  17  {
  18      public function compile(Compiler $compiler)
  19      {
  20          $left = $compiler->getVarName();
  21          $right = $compiler->getVarName();
  22          $compiler
  23              ->raw(sprintf('(is_string($%s = ', $left))
  24              ->subcompile($this->getNode('left'))
  25              ->raw(sprintf(') && is_string($%s = ', $right))
  26              ->subcompile($this->getNode('right'))
  27              ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right))
  28          ;
  29      }
  30  
  31      public function operator(Compiler $compiler)
  32      {
  33          return $compiler->raw('');
  34      }
  35  }
  36  
  37  class_alias('Twig\Node\Expression\Binary\EndsWithBinary', 'Twig_Node_Expression_Binary_EndsWith');


Generated: Sat Nov 4 14:26:03 2023 Cross-referenced by PHPXref 0.7.1