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

Breadcrumb

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

function ConstantTest::compile

Overrides TestExpression::compile

File

vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php, line 28

Class

ConstantTest
Checks if a variable is the exact same value as a constant.

Namespace

Twig\Node\Expression\Test

Code

public function compile(Compiler $compiler) : void {
    $compiler->raw('(')
        ->subcompile($this->getNode('node'))
        ->raw(' === constant(');
    if ($this->getNode('arguments')
        ->hasNode('1')) {
        $compiler->raw('get_class(')
            ->subcompile($this->getNode('arguments')
            ->getNode('1'))
            ->raw(')."::".');
    }
    $compiler->subcompile($this->getNode('arguments')
        ->getNode('0'))
        ->raw('))');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal