Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
47 | public function createSmartPager(AdapterInterface $adapter, $page, $limit) |
||
48 | { |
||
49 | $results = $adapter->getSlice($this->core->getOffset($page, $limit), $limit); |
||
50 | |||
51 | $count = $adapter->getCount(); |
||
52 | |||
53 | $pageCount = $this->core->getPageCount($count, $limit); |
||
54 | |||
55 | if ($page > $pageCount) { |
||
56 | $page = 1; |
||
57 | $results = $adapter->getSlice($this->core->getOffset($page, $limit), $limit); |
||
58 | } |
||
59 | |||
60 | return new Pager( |
||
61 | $page, |
||
62 | $limit, |
||
63 | $count, |
||
64 | $pageCount, |
||
65 | $results |
||
66 | ); |
||
67 | } |
||
68 | } |
||
69 |