You are here

public function Twig_Node_Expression_Array::hasElement in Zircon Profile 8.0

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

File

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