public static function data_decode($contents, $type = 'json') { if (strpos($type, 'json')) { return json_decode($contents, true); } else { //return RestUtils::xml_decode($contents); $xml = simplexml_load_string($contents); } return RestUtils::objectsIntoArray($xml); }