Total Complexity | 5 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | class SolrPaginator extends AbstractPaginator |
||
19 | { |
||
20 | /** |
||
21 | * @var SolrSearch |
||
22 | */ |
||
23 | private SolrSearch $solrSearch; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | private array $paginatedItems = []; |
||
29 | |||
30 | public function __construct( |
||
31 | SolrSearch $solrSearch, |
||
32 | int $currentPageNumber = 1, |
||
33 | int $itemsPerPage = 25 |
||
34 | ) { |
||
35 | $this->solrSearch = $solrSearch; |
||
36 | $this->setCurrentPageNumber($currentPageNumber); |
||
37 | $this->setItemsPerPage($itemsPerPage); |
||
38 | |||
39 | $this->updateInternalState(); |
||
40 | } |
||
41 | |||
42 | protected function updatePaginatedItems(int $itemsPerPage, int $offset): void |
||
43 | { |
||
44 | $this->solrSearch->submit($offset, $itemsPerPage); |
||
45 | $this->paginatedItems = $this->solrSearch->toArray(); |
||
46 | } |
||
47 | |||
48 | protected function getTotalAmountOfItems(): int |
||
51 | } |
||
52 | |||
53 | protected function getAmountOfItemsOnCurrentPage(): int |
||
56 | } |
||
57 | |||
58 | public function getPaginatedItems(): iterable |
||
61 | } |
||
62 | } |
||
63 |