Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EndsWithBinary.php

function EndsWithBinary::compile

Overrides AbstractBinary::compile

File

vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php, line 18

Class

EndsWithBinary

Namespace

Twig\Node\Expression\Binary

Code

public function compile(Compiler $compiler) : void {
    $left = $compiler->getVarName();
    $right = $compiler->getVarName();
    $compiler->raw(\sprintf('(is_string($%s = ', $left))
        ->subcompile($this->getNode('left'))
        ->raw(\sprintf(') && is_string($%s = ', $right))
        ->subcompile($this->getNode('right'))
        ->raw(\sprintf(') && str_ends_with($%1$s, $%2$s))', $left, $right));
}
RSS feed
Powered by Drupal