public function getFirstElementOfType($classnames)
    {
        if (!is_array($classnames)) {
            $classnames = array($classnames);
        }

        foreach (array_keys($this->_data) as $key) {
            $element = $this->getData($key);

            if (!is_object($element)) {
                continue;
            }

            foreach ($classnames as $classname) {
                if (is_a($element, $classname)) {
                    return $element;
                }
            }
        }
    }