Beispiel #1
0
 public function __construct(Client $client, Api\Response $response)
 {
     $this->httpClient = $client->getHttpClient();
     $resource = $response->toArray();
     $params = $response->request->getParameters();
     $this->firstPage = isset($params['page']) ? (int) max($params['page'], 1) : 1;
     $this->perPage = isset($params['per_page']) ? (int) $params['per_page'] : count($resource);
     $this->responses[$this->firstPage] = $response;
     $this->resources[$this->firstPage] = $resource;
 }
Beispiel #2
0
 /**
  * @param Api\Response $response
  */
 public function success(Api\Response $response)
 {
     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();
     $current->result = $response->toArray() ?: $response->getContent();
 }