queryResult = $queryResult; $this->setCurrentPageNumber($currentPageNumber); $this->setItemsPerPage($itemsPerPage); $this->initialLimit = $initialLimit; $this->initialOffset = $initialOffset; $this->updateInternalState(); } /** * @return iterable|QueryResultInterface */ public function getPaginatedItems(): iterable { return $this->paginatedQueryResult; } protected function updatePaginatedItems(int $limit, int $offset): void { $this->paginatedQueryResult = $this->queryResult ->getQuery() ->setLimit($limit) ->setOffset($offset) ->execute(); } protected function getTotalAmountOfItems(): int { return count($this->queryResult); } protected function getAmountOfItemsOnCurrentPage(): int { return count($this->paginatedQueryResult); } }