public function getParentOfType($type)
    {
        if (is_a($this, $type)) {
            return $this;
        }
        
        if ($this->parent !== null) {
            return $this->parent->getParentOfType($type);
        }
        
        return false;
    }