Phan\Language\Element\Clazz::getHierarchyRootFQSEN PHP Method

getHierarchyRootFQSEN() public method

public getHierarchyRootFQSEN ( CodeBase $code_base ) : FullyQualifiedClassName
$code_base Phan\CodeBase The entire code base from which we'll find ancestor details
return Phan\Language\FQSEN\FullyQualifiedClassName The FQSEN of the root class on this class's hiearchy
    public function getHierarchyRootFQSEN(CodeBase $code_base) : FullyQualifiedClassName
    {
        if (!$this->hasParentType()) {
            return $this->getFQSEN();
        }
        if (!$code_base->hasClassWithFQSEN($this->getParentClassFQSEN())) {
            // Let this emit an issue elsewhere for the
            // parent not existing
            return $this->getFQSEN();
        }
        // Get the parent class
        $parent = $this->getParentClass($code_base);
        // Prevent infinite loops
        if ($parent == $this) {
            return $this->getFQSEN();
        }
        return $parent->getHierarchyRootFQSEN($code_base);
    }