content) || ! isset($xml->content->appdata)) { throw new \Exception("Mallformed AppData xml"); } $data = array(); foreach (get_object_vars($xml->content->appdata) as $key => $val) { $data[trim($key)] = trim($val); } return $data; } public function convertJson($requestParam) { $ret = json_decode($requestParam, true); if ($ret == $requestParam) { throw new \Exception("Mallformed app data json string"); } return $ret; } public function convertXml($requestParam) { $xml = InputBasicXmlConverter::loadString($requestParam); if (! isset($xml->entry)) { throw new \Exception("Mallformed AppData xml"); } $data = array(); foreach ($xml->entry as $entry) { $key = trim($entry->key); $val = isset($entry->value) ? trim($entry->value) : null; $data[$key] = $val; } return $data; } }