<?php
>>388246
Тебе нужно просто сделать и возвращать объект с методами toJson/toXml:
return ApiResponse::error('Access denied');
$response = new ApiReponse;
$response->setError(ApiReponse::ERROR_ACCESS, 'Access denied');
return $response;
$response = new ApiReponse();
$response->setSuccess();
$response->addModel('user', $userInfo);
return $response;
PD9waHAKCj4+Mzg4MjQ2IAoK0KLQtdCx0LUg0L3Rg9C20L3QviDQv9GA0L7RgdGC0L4g0YHQtNC10LvQsNGC0Ywg0Lgg0LLQvtC30LLRgNCw0YnQsNGC0Ywg0L7QsdGK0LXQutGCINGBINC80LXRgtC+0LTQsNC80LggdG9Kc29uL3RvWG1sOgoKcmV0dXJuIEFwaVJlc3BvbnNlOjplcnJvcignQWNjZXNzIGRlbmllZCcpOwoKJHJlc3BvbnNlID0gbmV3IEFwaVJlcG9uc2U7CiRyZXNwb25zZS0+c2V0RXJyb3IoQXBpUmVwb25zZTo6RVJST1JfQUNDRVNTLCAnQWNjZXNzIGRlbmllZCcpOwpyZXR1cm4gJHJlc3BvbnNlOwoKJHJlc3BvbnNlID0gbmV3IEFwaVJlcG9uc2UoKTsKJHJlc3BvbnNlLT5zZXRTdWNjZXNzKCk7CiRyZXNwb25zZS0+YWRkTW9kZWwoJ3VzZXInLCAkdXNlckluZm8pOwpyZXR1cm4gJHJlc3BvbnNlOwoK