| Total Complexity | 9 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class Pagination |
||
| 9 | { |
||
| 10 | /** @var int */ |
||
| 11 | private $pageSize = 0; |
||
| 12 | |||
| 13 | /** @var int */ |
||
| 14 | private $current = 0; |
||
| 15 | |||
| 16 | /** @var int */ |
||
| 17 | private $count = 0; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param int $pageSize |
||
| 21 | * @param int $currentPage |
||
| 22 | */ |
||
| 23 | public function setPage($pageSize, $currentPage) |
||
| 24 | { |
||
| 25 | $this->pageSize = $pageSize; |
||
| 26 | $this->current = max($currentPage, 1); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function setCount($count) |
||
| 30 | { |
||
| 31 | $this->count = $count; |
||
| 32 | $this->current = min($this->last(), $this->current); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function pageSize() |
||
| 38 | } |
||
| 39 | |||
| 40 | public function count() |
||
| 41 | { |
||
| 42 | return $this->count; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function offset() |
||
| 48 | } |
||
| 49 | |||
| 50 | public function current() |
||
| 53 | } |
||
| 54 | |||
| 55 | public function last() |
||
| 58 | } |
||
| 59 | |||
| 60 | public function prev() |
||
| 61 | { |
||
| 62 | return max(1, $this->current - 1); |
||
| 63 | } |
||
| 64 | |||
| 65 | public function next() |
||
| 68 | } |
||
| 69 | } |
||
| 70 |