public static function url(array $request)
    {
        if (isset($request['url'])) {
            return $request['url'];
        }

        $uri = (isset($request['scheme'])
                ? $request['scheme'] : 'http') . '://';

        if ($host = self::header($request, 'host')) {
            $uri .= $host;
        } else {
            throw new \InvalidArgumentException('No Host header was provided');
        }

        if (isset($request['uri'])) {
            $uri .= $request['uri'];
        }

        if (isset($request['query_string'])) {
            $uri .= '?' . $request['query_string'];
        }

        return $uri;
    }
public static function url(array $request)
    {
        if (isset($request['url'])) {
            return $request['url'];
        }

        $uri = (isset($request['scheme'])
                ? $request['scheme'] : 'http') . '://';

        if ($host = self::header($request, 'host')) {
            $uri .= $host;
        } else {
            throw new \InvalidArgumentException('No Host header was provided');
        }

        if (isset($request['uri'])) {
            $uri .= $request['uri'];
        }

        if (isset($request['query_string'])) {
            $uri .= '?' . $request['query_string'];
        }

        return $uri;
    }
public static function url ( array $ request ) { if ( isset ( $ request [ 'url' ] ) ) { return $ request [ 'url' ] ; } $ uri = ( isset ( $ request [ 'scheme' ] ) ? $ request [ 'scheme' ] : 'http' ) . '://' ; if ( $ host = self :: header ( $ request , 'host' ) ) { $ uri .= $ host ; } else { throw new \ InvalidArgumentException ( 'No Host header was provided' ) ; } if ( isset ( $ request [ 'uri' ] ) ) { $ uri .= $ request [ 'uri' ] ; } if ( isset ( $ request [ 'query_string' ] ) ) { $ uri .= '?' . $ request [ 'query_string' ] ; } return $ uri ; }
Creates a URL string from a request.

If the "url" key is present on the request, it is returned, otherwise
the url is built up based on the scheme, host, uri, and query_string
request values.

@param array $request Request to get the URL from

@return string Returns the request URL as a string.
@throws \InvalidArgumentException if no Host header is present.
Creates a URL string from a request .