public function parseInto(Query $query, $str, $urlEncoding = true)
    {
        if ($str === '') {
            return;
        }

        $result = [];
        $this->duplicates = false;
        $this->numericIndices = true;
        $decoder = self::getDecoder($urlEncoding);

        foreach (explode('&', $str) as $kvp) {

            $parts = explode('=', $kvp, 2);
            $key = $decoder($parts[0]);
            $value = isset($parts[1]) ? $decoder($parts[1]) : null;

            // Special handling needs to be taken for PHP nested array syntax
            if (strpos($key, '[') !== false) {
                $this->parsePhpValue($key, $value, $result);
                continue;
            }

            if (!isset($result[$key])) {
                $result[$key] = $value;
            } else {
                $this->duplicates = true;
                if (!is_array($result[$key])) {
                    $result[$key] = [$result[$key]];
                }
                $result[$key][] = $value;
            }
        }

        $query->replace($result);

        if (!$this->numericIndices) {
            $query->setAggregator(Query::phpAggregator(false));
        } elseif ($this->duplicates) {
            $query->setAggregator(Query::duplicateAggregator());
        }
    }