| Conditions | 6 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 13 | public function handle($data, bool $pagination, int $page = 1, int $maxPerPage = 25) |
||
| 14 | { |
||
| 15 | if ('pagerfanta' === $pagination) { |
||
|
|
|||
| 16 | if ($data instanceof QueryBuilder || $data instanceof Query) { |
||
| 17 | $adapter = new DoctrineORMAdapter($data, true, true); |
||
| 18 | } else { |
||
| 19 | $adapter = new ArrayAdapter($data); |
||
| 20 | } |
||
| 21 | $pager = new Pagerfanta($adapter); |
||
| 22 | $pager->setCurrentPage($page); |
||
| 23 | $pager->setMaxPerPage($maxPerPage); |
||
| 24 | |||
| 25 | return $pager; |
||
| 26 | } |
||
| 27 | |||
| 28 | if ($data instanceof Query) { |
||
| 29 | return $data->getResult(); |
||
| 30 | } |
||
| 31 | |||
| 32 | if ($data instanceof QueryBuilder) { |
||
| 33 | return $data->getQuery()->getResult(); |
||
| 34 | } |
||
| 35 | |||
| 36 | return $data; |
||
| 37 | } |
||
| 39 |