/** * Строит OpenSocial.Result или OpenSocial.Collection * * @param OpenSocial_Serivce $service * @param Net_HTTP_Response $response * * @return Service_OpenSocial_ResultInterface */ protected function make_result(Service_OpenSocial_Service $service, $data) { if (isset($data->list) && is_array($data->list)) { $result = new Service_OpenSocial_Collection(isset($data->totalResults) ? $data->totalResults : 0, isset($data->itemsPerPage) ? $data->itemsPerPage : 0, isset($data->startIndex) ? $data->startIndex : 0); foreach ($data->list as $item) { $result->append($service->make_resource_for($item)); } } else { $result = $service->make_resource_for($data); } return $result; }
/** * @param string $property * @param $value * * @return Service_OpenSocial_Request */ public function __set($property, $value) { switch ($property) { case 'id': case 'user_id': case 'group_id': case 'app_id': case 'resource_id': $this->{$property} = (string) $value; break; case 'service': $this->service = Service_OpenSocial_Service::object($value); break; case 'operation': $this->operation = Service_OpenSocial_Operation::object($value); break; case 'resource': $this->resource($value); break; default: $this->params[$property] = $value; } return $this; }