| Total Complexity | 7 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class PageArray implements PageInterface |
||
| 11 | { |
||
| 12 | private array $items; |
||
| 13 | private int $offset; |
||
| 14 | private int $limit; |
||
| 15 | private int $totalCount; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param array $items |
||
| 19 | */ |
||
| 20 | public function __construct(array $items, int $offset, int $limit, int $totalCount) |
||
| 21 | { |
||
| 22 | $this->items = $items; |
||
| 23 | $this->offset = $offset; |
||
| 24 | $this->limit = $limit; |
||
| 25 | $this->totalCount = $totalCount; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function count(): int |
||
| 29 | { |
||
| 30 | return count($this->items); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function totalCount(): int |
||
| 34 | { |
||
| 35 | return $this->totalCount; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getCurrentOffset(): int |
||
| 41 | } |
||
| 42 | |||
| 43 | public function getCurrentPage(): int |
||
| 44 | { |
||
| 45 | return (int) floor($this->offset / $this->limit) + 1; |
||
| 46 | } |
||
| 47 | |||
| 48 | public function getCurrentLimit(): int |
||
| 51 | } |
||
| 52 | |||
| 53 | public function getIterator(): Traversable |
||
| 56 | } |
||
| 57 | } |
||
| 58 |