public function decodeData($data)
    {
        $output = array();
        while (strlen($data) > 0) {
            preg_match('/(\w+)(\[(\d+)\])?=/', $data, $matches);
            $key = $matches[1];
            $data = substr($data, strlen($matches[0]));

            if (isset($matches[3])) {
                $value = substr($data, 0, $matches[3]);
            } else {
                $next = strpos($data, '&');
                $value = $next === false ? $data : substr($data, 0, $next);
            }

            $data = substr($data, strlen($value) + 1);
            $output[$key] = $value;
        }

        return $output;
    }