Gajus\Fuss\App::getTopUrl PHP Method

getTopUrl() public method

This is an attempt to reconstruct the top URL with whatever accompanying state data.
public getTopUrl ( ) : string
return string
    public function getTopUrl()
    {
        $signed_request = $this->getSignedRequest();
        if (!$signed_request) {
            throw new Exception\AppException('App is not loaded in Page Tab or Canvas.');
        }
        if ($signed_request->isPageTab()) {
            $top_url = 'https://www.facebook.com/' . $signed_request->getPageTab()->getId() . '/app_' . $this->getId();
            if ($app_data = $signed_request->getAppData()) {
                $top_url .= '?' . http_build_query(['app_data' => $app_data]);
            }
        } else {
            $top_url = 'https://apps.facebook.com/' . $this->getId() . '/';
            if (!empty($_SERVER['QUERY_STRING'])) {
                $top_url .= '?' . $_SERVER['QUERY_STRING'];
            }
        }
        return $top_url;
    }