public function Twig_Node_Expression_Array::hasElement

File

drupal/core/vendor/twig/twig/lib/Twig/Node/Expression/Array.php, line 41

Class

Twig_Node_Expression_Array

Code

public function hasElement(Twig_Node_Expression $key) {
  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;
}