/** * @param ApiCall $client * @param IPub\OAuth\Api\Response $response */ public function __construct(ApiCall $client, IPub\OAuth\Api\Response $response) { $this->client = $client; $this->httpClient = $client->getHttpClient(); $resource = $response->toArray(); $params = $response->request->getParameters(); $this->perPage = isset($params['count']) ? (int) $params['count'] : count($resource); $this->responses[$this->firstPage] = $response; $this->resources[$this->firstPage] = $resource; }
/** * @param Api\Response $response * @param \Exception $exception */ private function processEvent(Api\Response $response, \Exception $exception = NULL) { if (!isset($this->calls[$oid = spl_object_hash($response->getRequest())])) { return; } $debugInfo = $response->debugInfo; $current = $this->calls[$oid]; $this->totalTime += $current->time = $debugInfo['total_time']; unset($debugInfo['total_time']); $current->info = $debugInfo; $current->info['method'] = $response->getRequest()->getMethod(); if ($exception) { $current->exception = $exception; } else { $current->result = $response->toArray() ?: $response->getContent(); } }