Get the URL of current request.

@param bool $includeQuery <p>Include the query string in the result</p>
@return Url The URL of the current request or cli if called from the command line
422821
public function current($includeQuery = true)
    {
        $url = "";
        if (!$this->serverVars && php_sapi_name() == 'cli') {
            $url = "cli";
        } else {
            $url .= $this->currentScheme().$this->currentHost();
            $port = $this->currentPort();
            if (!in_array($port, [ false, 80])) {
                $url .= ':'.$port;
            }
            $url .= $this->currentPath();
            if ($includeQuery) {
                $query = $this->currentQuery();
                if ($query) {
                    $url .= '?'.$query;
                }
            }
        }
        return static::create($url);
    }
1160458
public function fullUrl()
    {
        $query = $this->getQueryString();

        return $query ? $this->url().'?'.$query : $this->url();
    }
1374494
protected String getQueryUrl(String hostOrKey, String index, String type, String id, Object query) {
        return getElasticSearchUrl(hostOrKey) + formatQueryUrl(index, type, id, query);
    }
27085
public function getAbsoluteUrl($strip = true)
    {
        $url = $this->getHostInfo() . $this->getUrl();
        return $strip === true ? strip_tags($url) : $url;
    }
573454
public function uri($query = false)
    {
        return rtrim($this->baseName(), '/') . '/' . ltrim($this->path($query), '/');
    }
509371
public function getIndexUrl($index)
    {
        $oParam = (int) $this->current()->query->getValue('o') + $index;
        $newQuery = new MergeQuery('o='.$oParam);

        return $newQuery($this->url);
    }
342641
public static function mergeQuery($url, array $query)
    {
        // No query.
        if (!$query) {
            return $url;
        }

        $queryString = http_build_query($query);
        $qPos = strpos($url, '?');
        $hashPos = strpos($url, '#');
        $pos = strlen($url);
        $hasQuery = $qPos !== false && ($qPos < $hashPos || $hashPos === false);

        if ($qPos || $hashPos) {
            $pos = $hasQuery ? $qPos + 1 : $hashPos;
        }

        $prefix = substr($url, 0, $pos);
        $suffix = substr($url, $pos);

        return sprintf(
            '%s%s%s%s%s',
            $prefix,
            $hasQuery ? '' : '?',
            $queryString,
            $hasQuery ? '&' : '',
            $suffix
        );
    }
655240
public static function getPathAndQueryFromUrl($url)
    {
        $parsedUrl = parse_url($url);
        $result = '';
        if (isset($parsedUrl['path'])) {
            if (substr($parsedUrl['path'], 0, 1) == '/') {
                $parsedUrl['path'] = substr($parsedUrl['path'], 1);
            }
            $result .= $parsedUrl['path'];
        }
        if (isset($parsedUrl['query'])) {
            $result .= '?' . $parsedUrl['query'];
        }
        return $result;
    }
117939
public function getRequestUrl($url)
    {
        if ($this->getPerPage() && $this->getPage()) {
            return $url . $this->getRequestPageInfo();
        }

        return $url;
    }
466353
public function rootUrl($include_host = false)
    {
        if ($include_host) {
            return $this->root;
        }

        return str_replace($this->base, '', $this->root);
    }
958647
public function out_omit_querystring($includeanchor = false) {

        $uri = $this->scheme ? $this->scheme.':'.((strtolower($this->scheme) == 'mailto') ? '':'//'): '';
        $uri .= $this->user ? $this->user.($this->pass? ':'.$this->pass:'').'@':'';
        $uri .= $this->host ? $this->host : '';
        $uri .= $this->port ? ':'.$this->port : '';
        $uri .= $this->path ? $this->path : '';
        if ($includeanchor and !is_null($this->anchor)) {
            $uri .= '#' . $this->anchor;
        }

        return $uri;
    }
61515
protected function _getUrlFromRequest(UriInterface $uri, $getFullUrl = false)
    {
        if (property_exists($uri, 'base')) {
            $uri = $uri->withPath($uri->base . $uri->getPath());
        }

        if ($getFullUrl) {
            return (string)$uri;
        }

        return $uri->getPath();
    }
985034
public function url($path = '', array $query = array(), $absolute = false, $exclude_lang = false)
    {
        return $this->url->get($path, $query, $absolute, $exclude_lang);
    }
735281
public function getQueryUrl($majorProtocolVersion = null,
        $minorProtocolVersion = null)
    {
        if (isset($this->_url)) {
            $url = $this->_url;
        } else {
            $url = Zend_Gdata_YouTube::VIDEO_URI;
        }
        if ($this->getCategory() !== null) {
            $url .= '/-/' . $this->getCategory();
        }
        $url = $url . $this->getQueryString($majorProtocolVersion,
            $minorProtocolVersion);
        return $url;
    }
433036
function current_page_url() {
            $url = 'http';

            if ( isset( $_SERVER["HTTPS"] ) ) {
                if ( $_SERVER["HTTPS"] == "on" ) {
                    $url .= "s";
                }
            }
            $url .= "://";
            if ( $_SERVER["SERVER_PORT"] != "80" ) {
                $url .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
            } else {
                $url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
            }

            return esc_url( $url );
        }
674726
public function getQuery() : ?string 
    {
        if ( ! $this->hasQuery()) {
            $this->setQuery($this->getDefaultQuery());
        }
        return $this->query;
    }
530721
protected function list_questions_url($includeauto = null) {
        $url = $this->base_url();

        $url->params($this->viewoptions);

        if (!is_null($includeauto)) {
            $url->param('includeauto', $includeauto);
        }

        return $url;
    }