/** * @return bool * @throws ClientErrorResponseException * @throws \Exception */ protected function loadItems() { $this->maxResults = $this->config->getParam('maxResults', $this->maxResults); $this->pageSize = $this->config->getParam('pageSize', $this->pageSize); if ($this->page >= $this->maxResults) { return false; } try { $this->result = $this->cnetAdapter->getEventList($this->page, $this->pageSize); } catch (\Exception $e) { throw $e; } $this->page += $this->result->getTotalResultsfound(); $this->result->rewind(); return (bool) $this->result->getTotalResultsfound(); }
/** * Build the api call url * NOTE: Calling this method will increase the page by one every call. * * @return string */ public function buildUrl() { $page = $this->page; $this->page++; return $this->config->buildApiUrl($page); }
/** * @param int $page * @param int $pageSize * @param \Guzzle\Http\Message\RequestInterface $request */ private function applyPaging($page, $pageSize, $request) { $request->getQuery()->set('start', $this->config->getParam('start', $page)); $request->getQuery()->set('rows', $pageSize); }