public static function getUri()
    {
        // Set basic protocol.
        $parts = [$uri = self::getScheme(), '://'];

        // Set auth username and auth password.
        $authUsername = self::getAuthUsername();
        $authPassword = self::getAuthPassword();
        if ($authUsername !== null && $authPassword !== null) {
            $parts[] = $authUsername . ':' . $authPassword . '@';
        }

        // Set host.
        $parts[] = self::getHost();

        // Set port.
        $port = self::getPort();
        if ($port != self::getStandardPort(self::getScheme())) {
            $parts[] = ':' . $port;
        }

        // Set path.
        $path = self::getPath();
        if ($path !== null && $path != '') {
            $parts[] = '/' . $path;
        }

        // Set query.
        $query = Input::getQuery();
        if (is_array($query) && count($query) > 0) {
            $queryString = [];
            foreach ($query as $key => $value) {
                $queryKeyValue = $key . '=';
                if ($value !== null) {
                    if (is_string($value)) {
                        $value = urlencode($value);
                    }
                    $queryKeyValue .= $value;
                }
                $queryString[] = $queryKeyValue;
            }
            if (count($queryString) > 0) {
                $parts[] = '?' . implode('&', $queryString);
            }
        }

        return implode('', $parts);
    }