/** * @param $resp * @param $responseFormat * * @return object * * @throws BadJSONException */ public static function parseResp($resp, $responseFormat) { if ($responseFormat == 'json') { $resp = NetworkUtils::getJSONStr($resp); $jsonObj = json_decode($resp); $respObj = array(); $respObj['parsed'] = $jsonObj; return (object) $respObj; } else { if ($responseFormat == 'xml') { // TODO: handle XML } } }