src/EndpointDiscovery/EndpointDiscoveryMiddleware.php
private function parseEndpoint($endpoint)
    {
        $parsed = parse_url($endpoint);

        // parse_url() will correctly parse full URIs with schemes
        if (isset($parsed['host'])) {
            return $parsed;
        }

        // parse_url() will put host & path in 'path' if scheme is not provided
        if (isset($parsed['path'])) {
            $split = explode('/', $parsed['path'], 2);
            $parsed['host'] = $split[0];
            if (isset($split[1])) {
                $parsed['path'] = $split[1];
            } else {
                $parsed['path'] = '';
            }
            return $parsed;
        }

        throw new UnresolvedEndpointException("The supplied endpoint '"
            . "{$endpoint}' is invalid.");
    }
private function parseEndpoint($endpoint)
    {
        $parsed = parse_url($endpoint);

        // parse_url() will correctly parse full URIs with schemes
        if (isset($parsed['host'])) {
            return $parsed;
        }

        // parse_url() will put host & path in 'path' if scheme is not provided
        if (isset($parsed['path'])) {
            $split = explode('/', $parsed['path'], 2);
            $parsed['host'] = $split[0];
            if (isset($split[1])) {
                $parsed['path'] = $split[1];
            } else {
                $parsed['path'] = '';
            }
            return $parsed;
        }

        throw new UnresolvedEndpointException("The supplied endpoint '"
            . "{$endpoint}' is invalid.");
    }
private function parseEndpoint ( $ endpoint ) { $ parsed = parse_url ( $ endpoint ) ; // parse_url() will correctly parse full URIs with schemes if ( isset ( $ parsed [ 'host' ] ) ) { return $ parsed ; } // parse_url() will put host & path in 'path' if scheme is not provided if ( isset ( $ parsed [ 'path' ] ) ) { $ split = explode ( '/' , $ parsed [ 'path' ] , 2 ) ; $ parsed [ 'host' ] = $ split [ 0 ] ; if ( isset ( $ split [ 1 ] ) ) { $ parsed [ 'path' ] = $ split [ 1 ] ; } else { $ parsed [ 'path' ] = '' ; } return $ parsed ; } throw new UnresolvedEndpointException ( "The supplied endpoint '" . "{$endpoint}' is invalid." ) ; }
Parses an endpoint returned from the discovery API into an array with
'host' and 'path' keys.

@param $endpoint
@return array
Parses an endpoint returned from the discovery API into an array with host and path keys .