Happyr\LinkedIn\Http\UrlGenerator::getCurrentUrl PHP Method

getCurrentUrl() public method

public getCurrentUrl ( )
    public function getCurrentUrl()
    {
        $protocol = $this->getHttpProtocol() . '://';
        $host = $this->getHttpHost();
        $currentUrl = $protocol . $host . $_SERVER['REQUEST_URI'];
        $parts = parse_url($currentUrl);
        $query = '';
        if (!empty($parts['query'])) {
            // drop known linkedin params
            $query = $this->dropLinkedInParams($parts['query']);
        }
        // use port if non default
        $port = isset($parts['port']) && ($protocol === 'http://' && $parts['port'] !== 80 || $protocol === 'https://' && $parts['port'] !== 443) ? ':' . $parts['port'] : '';
        // rebuild
        return $protocol . $parts['host'] . $port . $parts['path'] . $query;
    }