public static function to_array($data = null) { $array = array(); foreach ((array) $data as $key => $value) { if (is_object($value) or is_array($value)) { $array[$key] = mgm_format::to_array($value); } else { $array[$key] = $value; } } return $array; }
private function _get_request_body() { // format switch ($this->request->format) { case 'json': // json, .json return mgm_format::to_array(mgm_format::from_json($this->request->data['body'])); break; case 'phps': // php serialize, .phps return mgm_format::to_array(mgm_format::from_phps($this->request->data['body'])); break; case 'php': // php array, .php return mgm_format::to_array(mgm_format::from_php($this->request->data['body'])); break; case 'xml': // xml, .xml // xml, .xml default: return mgm_format::to_array(mgm_format::from_xml($this->request->data['body'])); break; } }