/** * Load the next page in the collection and populate the current items. * * @return bool * * @throws \Exception */ public function load() { if (!isset($this->links['next'])) { throw new \Exception('No more pages to load.'); } $collection = $this->client->get($this->links['next']); if (!$collection instanceof self) { throw new \Exception('Expected ' . __CLASS__ . ', but got ' . (is_object($collection) ? get_class($collection) : (string) $collection)); } $this->items += $collection->getItems(); return true; }