public function topParent()
    {
        $topParent = $this->parent();

        if (!$topParent) {
            return null;
        }

        while (true) {
            $theParent = $topParent->parent();
            if ($theParent !== null && $theParent->parent() !== null) {
                $topParent = $theParent;
            } else {
                break;
            }
        }

        return $topParent;
    }
public function topParent()
    {
        $topParent = $this->parent();

        if (!$topParent) {
            return null;
        }

        while (true) {
            $theParent = $topParent->parent();
            if ($theParent !== null && $theParent->parent() !== null) {
                $topParent = $theParent;
            } else {
                break;
            }
        }

        return $topParent;
    }
public function topParent ( ) { $ topParent = $ this -> parent ( ) ; if ( ! $ topParent ) { return null ; } while ( true ) { $ theParent = $ topParent -> parent ( ) ; if ( $ theParent !== null && $ theParent -> parent ( ) !== null ) { $ topParent = $ theParent ; } else { break ; } } return $ topParent ; }
Gets the top parent object for this page

@return PageInterface|null the top parent page object if it exists.
Gets the top parent object for this page