public static function fromString($query, array $data = [])
    {
        $url = parse_url($query);
        $query = isset($url['query']) ? $url['query'] : $url['path'];
        parse_str($query, $data);

        return new QueryString($data);
    }
public static function fromString($query, array $data = [])
    {
        $url = parse_url($query);
        $query = isset($url['query']) ? $url['query'] : $url['path'];
        parse_str($query, $data);

        return new QueryString($data);
    }
public static function fromString ( $ query , array $ data = [ ] ) { $ url = parse_url ( $ query ) ; $ query = isset ( $ url [ 'query' ] ) ? $ url [ 'query' ] : $ url [ 'path' ] ; parse_str ( $ query , $ data ) ; return new QueryString ( $ data ) ; }
Creates a QueryString from a string.

@param string $query A url or query string part.
@param array $data An optional data array.
@return QueryString
Creates a QueryString from a string .