public function Twig_Node_Expression_Array::hasElement in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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
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;
}