protected function parseUrl($url)
    {
        $parsed = \parse_url($url);

        if (false === $parsed) {
            throw new MalformedUrlException($url);
        }

        $server = \array_replace(['scheme' => 'http',
                                 'host'   => 'localhost',
                                 'query'  => []
                                ], $parsed);

        if (!isset($server['port'])) {
            $server['port'] = 'https' === $server['scheme'] ? 443 : 80;
        }

        if (!isset($server['path']) || $server['path']=='/') {
            $server['path'] = 'socket.io';
        }

        if (!\is_array($server['query'])) {
            \parse_str($server['query'], $query);
            $server['query'] = $query;
        }

        $server['secured'] = 'https' === $server['scheme'];

        return $server;
    }
protected function parseUrl($url)
    {
        $parsed = \parse_url($url);

        if (false === $parsed) {
            throw new MalformedUrlException($url);
        }

        $server = \array_replace(['scheme' => 'http',
                                 'host'   => 'localhost',
                                 'query'  => []
                                ], $parsed);

        if (!isset($server['port'])) {
            $server['port'] = 'https' === $server['scheme'] ? 443 : 80;
        }

        if (!isset($server['path']) || $server['path']=='/') {
            $server['path'] = 'socket.io';
        }

        if (!\is_array($server['query'])) {
            \parse_str($server['query'], $query);
            $server['query'] = $query;
        }

        $server['secured'] = 'https' === $server['scheme'];

        return $server;
    }
protected function parseUrl ( $ url ) { $ parsed = \ parse_url ( $ url ) ; if ( false === $ parsed ) { throw new MalformedUrlException ( $ url ) ; } $ server = \ array_replace ( [ 'scheme' => 'http' , 'host' => 'localhost' , 'query' => [ ] ] , $ parsed ) ; if ( ! isset ( $ server [ 'port' ] ) ) { $ server [ 'port' ] = 'https' === $ server [ 'scheme' ] ? 443 : 80 ; } if ( ! isset ( $ server [ 'path' ] ) || $ server [ 'path' ] == '/' ) { $ server [ 'path' ] = 'socket.io' ; } if ( ! \ is_array ( $ server [ 'query' ] ) ) { \ parse_str ( $ server [ 'query' ] , $ query ) ; $ server [ 'query' ] = $ query ; } $ server [ 'secured' ] = 'https' === $ server [ 'scheme' ] ; return $ server ; }
Parse an url into parts we may expect

@param string $url

@return string[] information on the given URL
Parse an url into parts we may expect