private function toCollection(ResponseInterface $response, $method) { $data = $this->decode($response); $coll = new ResourceCollection($data['pagination']['previous_uri'], $data['pagination']['next_uri']); foreach ($data['data'] as $resource) { $coll->add($this->{$method}($resource)); } return $coll; }
private function loadNext(ResourceCollection $collection, array $params, $mapperMethod) { $response = $this->http->get($collection->getNextUri(), $params); $nextPage = $this->mapper->{$mapperMethod}($response); $collection->mergeNextPage($nextPage); }
public function testGetLastIdEmptyCollection() { $coll = new ResourceCollection(); $this->assertNull($coll->getLastId()); }