Returns full uri string

@param bool $withoutHost (optional) If is set to true, means that host / server name is omitted
@return string
486592
public static function getFullUri($withoutHost = false)
    {
        $requestedUrl = Miscellaneous::getSafelyGlobalVariable(INPUT_SERVER, 'REQUEST_URI');

        /*
         * Unknown requested url?
         * Nothing to do
         */
        if (empty($requestedUrl)) {
            return '';
        }

        /*
         * Without host / server name?
         * All is done
         */
        if ($withoutHost) {
            return $requestedUrl;
        }

        return self::getServerNameOrIp(true) . $requestedUrl;
    }
212905
function build_url( $parts = null )
	{
		if (is_string($parts))
		{
			if ($parts === '' || $parts === '//')
				return $this->uri->withScheme(null);								//	'//' . $this->uri->authority . $this->uri->getPathAndQuery();
			if ($parts[0] === '/')
				return $this->uri->getLeftPart(Uri::PARTIAL_AUTHORITY) . $parts;	//	(_::is_https() ? 'https://' : 'http://') . _::request('host') . $parts;
			if ($parts === 'https' || $parts === 'http')
				return $this->uri->withScheme($parts);								//	$parts . '://' . _::request('host') . _::request('uri');
			if ($parts[0] === '?')
				return $this->uri->getLeftPart(Uri::PARTIAL_PATH) . $parts;			//	(_::is_https() ? 'https://' : 'http://') . _::request('host') . _::request('path') . $parts;
			if (strpos($parts, '=') !== false)
				return $this->uri->getLeftPart(Uri::PARTIAL_PATH) . '?' . $parts;	//	(_::is_https() ? 'https://' : 'http://') . _::request('host') . _::request('path') . '?' . $parts;
			if ($parts[0] === '#')
				return $this->uri->withFragment($parts);							//	(_::is_https() ? 'https://' : 'http://') . _::request('host') . _::request('uri') . $parts;
			throw new \Exception("Invalid call to Request::build_url('{$parts}')");
		}
		return (string) (new Uri($parts));
/*
		return	(isset($parts['scheme']) ? (empty($parts['scheme']) ? '//' : $parts['scheme'] . '://') : ($this->uri->scheme ?? 'http') : 'http://')) .	// Can set `scheme` to NULL to generate a Protocol-Relative-URL!
				'//' . (empty($parts['host']) ? $this->uri->authority : $parts['host']) .
				(empty($parts['path']) ? _::request('path') : $parts['path']) .
				(isset($parts['query']) ? (empty($parts['query']) ? null : '?' . $parts['query']) : (empty($parts['path']) && _::request('query') ? '?' . _::request('query') : null)); // NO FRAGMENT! We can append it if we really need it!
*/
	}
1128414
public static function root($addAuth = false)
    {
        $url = '';

        // Check to see if it's over https
        $isHttps = self::isHttps();

        // Was a username or password passed?
        if ($addAuth) {
            $url .= self::getAuth();
        }

        $serverData = data($_SERVER);

        // We want the user to stay on the same host they are currently on,
        // but beware of security issues
        // see http://shiflett.org/blog/2006/mar/server-name-versus-http-host
        $host = $serverData->get('HTTP_HOST');
        $port = (int)$serverData->get('SERVER_PORT');
        $url .= str_replace(':' . $port, '', $host);

        // Is it on a non standard port?
        if ($isHttps && $port !== self::PORT_HTTPS) {
            $url .= $port ? ":{$port}" : '';
        } elseif (!$isHttps && $port !== self::PORT_HTTP) {
            $url .= $port ? ":{$port}" : '';
        }

        if ($url) {
            if ($isHttps) {
                return 'https://' . $url;
            }
            return 'http://' . $url;
        }

        return null;
    }
818526
public function url($withParams = true)
    {
        if ($withParams) {
            return (string)$this->uri;
        } else {
            return $this->root() . $this->uri->path;
        }
    }
1260280
public function url($withParams = false)
    {
        $url = $this->scheme() . '://';
        $url .= $this->domain();

        return $url . $this->urlPath($withParams);
    }
161335
function makeUri($uri) {
      $a = parse_url($uri);

      if ( (isset($a['scheme'])) && (isset($a['host'])) ) {
        $this->url = $a;
      } else {
        unset($this->url['query']);
        unset($this->url['fragment']);
        $this->url = array_merge($this->url, $a);
      }

      if ($this->useProxy) {
        $requesturi = 'http://' . $this->url['host'] . (empty($this->url['port']) ? '' : ':' . $this->url['port']) . $this->url['path'] . (empty($this->url['query']) ? '' : '?' . $this->url['query']);
      } else {
        $requesturi = $this->url['path'] . (empty($this->url['query']) ? '' : '?' . $this->url['query']);
      }

      return $requesturi;
    }
1319989
public function getHttpHost($trimPort = true)
    {
        if (!isset($_SERVER['HTTP_HOST'])) {
            return false;
        }
        if ($trimPort) {
            $host = explode(':', $_SERVER['HTTP_HOST']);
            return $host[0];
        }
        return $_SERVER['HTTP_HOST'];
    }
646068
public function urlPath($withParams = false)
    {
        $path = $this->server('request_uri');

        if (!$withParams)
        {
            $position = mb_strpos($path, '?');
            if ($position !== false)
            {
                $path = mb_substr($path, 0, $position);
            }
        }

        return $path;
    }
943003
public function getBaseUri()
    {
        if ('' !== $qs = $this->getQueryString()) {
            $qs = '?' . $qs;
        }

        return $this->getSchemeAndHost() . $this->getRequestUri() . $qs;
    }
483579
public final function withUri(
       UriInterface $uri,
       $preserveHost = false): RequestInterface
   {
       if (true === $preserveHost
        && !array_key_exists("Host", $this->header)
        && $uri->getHost()) {
           return $this->with("uri", $uri)->withHeader("Host", $uri->getHost());
       }
       return $this->with("uri", $uri);
   }
214904
public function getHost() : string
    {
        $host = null;

        if ($this->isUsingTrustedProxy() && $this->headers->has(self::$trustedHeaderNames[RequestHeaders::CLIENT_HOST])) {
            $hosts = explode(',', $this->headers->get(self::$trustedHeaderNames[RequestHeaders::CLIENT_HOST]));
            $host = trim(end($hosts));
        }

        if ($host === null) {
            $host = $this->headers->get('HOST');
        }

        if ($host === null) {
            $host = $this->server->get('SERVER_NAME');
        }

        if ($host === null) {
            // Return an empty string by default so we can do string operations on it later
            $host = $this->server->get('SERVER_ADDR', '');
        }

        // Remove the port number
        $host = strtolower(preg_replace("/:\d+$/", '', trim($host)));

        // Check for forbidden characters
        // Credit: Symfony HTTPFoundation
        if (!empty($host) && !empty(preg_replace("/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/", '', $host))) {
            throw new InvalidArgumentException("Invalid host \"$host\"");
        }

        return $host;
    }
1017389
public function withUri(UriInterface $uri, $preserveHost = false)
    {
        $request = $this->copy();
        $request->uri = $uri;
        
        if (!$preserveHost) {
            $request = $request->withHeader('Host', $request->uri->getHost());
        }
        
        return $request;
    }
154246
protected function getHostFromUri()
    {
        $host = $this->uri->getHost();
        $host .= $this->uri->getPort() ? ':' . $this->uri->getPort() : '';

        return $host;
    }
1077544
public function extractHostname( $uri )
    {
        $hostname = false;

        $parts = parse_url( $uri );

        if ( isset( $parts['host'] ) )
            $hostname = $parts['host'];

        return $hostname;
    }
1180065
public static function extractHost($url)
    {
        $parsedUrl = parse_url($url);

        if (count($parsedUrl) == 1 && isset($parsedUrl['path'])) {
            $host = $parsedUrl['path'];
        } else {
            $host = $parsedUrl['host'];
        }

        if (substr($host, 0, 4) == 'www.') {
            $host = substr($host, 4);
        }

        return $host;
    }
205237
protected function getAdditionalUriData($uri)
    {
        if (strpos($uri, '?') !== false) {
            return substr($uri, strpos($uri, '?'));
        } else if (strpos($uri, '#') !== false) {
            return substr($uri, strpos($uri, '#'));
        }
        
        return '';
    }
497746
public function getEndpoint($endpoint, $withHost = false, $forceReload = false)
    {
        $this->loadApiDefinition($forceReload);
        $url = "";
        if ($withHost) {
            $url = empty($this->options['host']) ? $this->definition->getHost() : $this->options['host'];
        }

        // If the base path is not already included, we need to add it.
        $url .= (empty($this->options['includeBasePath']) ? $this->definition->getBasePath() : '') . $endpoint;

        return $url;
    }