public static function make(array $server = null)
    {
        $scheme = UriSchemeFactory::make($server);
        $host   = UriHostFactory::make($server);
        $port   = UriPortFactory::make($server);
        $path   = UriPathFactory::make($server);
        $query  = UriQueryFactory::make($server);

        $url = '';
        if ($host) {
            $url .= $scheme . '://' . $host . ':' . $port;
            $path = '/' . ltrim($path, '/');
        }
        $url .= $path;

        if ($query) {
            $url .= '?' . $query;
        }

        $uri = new Uri($url);

        if ($host) {
            return $uri;
        }

        return $uri->withScheme($scheme)->withPort($port);
    }