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

Breadcrumb

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

function ArrayExpression::hasElement

File

vendor/twig/twig/src/Node/Expression/ArrayExpression.php, line 46

Class

ArrayExpression

Namespace

Twig\Node\Expression

Code

public function hasElement(AbstractExpression $key) : bool {
    foreach ($this->getKeyValuePairs() as $pair) {
        // we compare the string representation of the keys
        // to avoid comparing the line numbers which are not relevant here.
        if ((string) $key === (string) $pair['key']) {
            return true;
        }
    }
    return false;
}

API Navigation

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