You are here

public function Twig_Node_Expression_Array::hasElement in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Node/Expression/Array.php \Twig_Node_Expression_Array::hasElement()

File

vendor/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;
}