1 | <?php |
||
8 | class PaginationFilter implements FilterInterface |
||
9 | { |
||
10 | /** @var int $page */ |
||
11 | private $page; |
||
12 | |||
13 | /** @var int $numPerPage */ |
||
14 | private $numPerPage; |
||
15 | |||
16 | /** @var int $totalRecords */ |
||
17 | private $totalRecords; |
||
18 | |||
19 | /** @var ArrayIterator $collection */ |
||
20 | private $collection; |
||
21 | |||
22 | /** @var int $resultsOffset */ |
||
23 | private $resultsOffset; |
||
24 | |||
25 | private $resultsEndOffset; |
||
26 | |||
27 | /** |
||
28 | * @param ArrayIterator $collection |
||
29 | * @return ArrayIterator |
||
30 | */ |
||
31 | 3 | public function filter(ArrayIterator $collection): ArrayIterator |
|
52 | |||
53 | 2 | private function getResults() |
|
64 | |||
65 | 2 | private function handleRow(int $x, ArrayIterator $results) |
|
75 | |||
76 | |||
77 | /** |
||
78 | * @return int |
||
79 | */ |
||
80 | 2 | public function getPage(): int |
|
84 | |||
85 | /** |
||
86 | * @param int $page |
||
87 | * @return PaginationFilter |
||
88 | */ |
||
89 | 3 | public function setPage(int $page): PaginationFilter |
|
94 | |||
95 | /** |
||
96 | * @return int |
||
97 | */ |
||
98 | 2 | public function getNumPerPage(): int |
|
102 | |||
103 | /** |
||
104 | * @param int $numPerPage |
||
105 | * @return PaginationFilter |
||
106 | */ |
||
107 | 3 | public function setNumPerPage(int $numPerPage): PaginationFilter |
|
112 | |||
113 | /** |
||
114 | * @return int |
||
115 | */ |
||
116 | 2 | public function getTotalPages() : int |
|
123 | } |