public function has($key)
    {
        foreach ($this->elements as $element) {
            if ($element->getKey() == $key) {
                return true;
            }
        }

        return false;
    }
public function has($key)
    {
        foreach ($this->elements as $element) {
            if ($element->getKey() == $key) {
                return true;
            }
        }

        return false;
    }
public function has ( $ key ) { foreach ( $ this -> elements as $ element ) { if ( $ element -> getKey ( ) == $ key ) { return true ; } } return false ; }
Checks if an element with the given key already exists

@param string|int            $key
@return bool
Checks if an element with the given key already exists