protected function getQueryParameters($query)
    {
        $pairs = explode('&', $query);

        $parameters = [];

        foreach ($pairs as $pair) {
            if ('' === trim($pair)) {
                continue;
            }

            $nameValue = explode('=', $pair);

            $name = urlencode($nameValue[0]);
            $value = urlencode($nameValue[1]);

            $parameters[$name] = $value;
        }

        return $parameters;
    }