| Conditions | 3 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | 2 | public function paginateResults ( |
|
| 30 | QueryBuilderOptions $queryOptions, |
||
| 31 | DoctrineORMAdapter $ormAdapter, |
||
| 32 | PagerfantaBuilder $pagerfantaBuilder, |
||
| 33 | $routeName, |
||
| 34 | $useResultCache |
||
| 35 | ) { |
||
| 36 | 2 | $limit = $queryOptions->get('limit', self::DEFAULT_LIMIT); |
|
| 37 | 2 | $page = $queryOptions->get('page', self::DEFAULT_PAGE); |
|
| 38 | |||
| 39 | 2 | $query = $ormAdapter->getQuery(); |
|
| 40 | 2 | if (isset($useResultCache) && $useResultCache) { |
|
| 41 | 1 | $query->useResultCache(true, self::DEFAULT_LIFETIME); |
|
| 42 | } |
||
| 43 | |||
| 44 | 2 | $route = $this->router->createRouter($queryOptions, $routeName); |
|
| 45 | |||
| 46 | 2 | return $pagerfantaBuilder->createRepresentation($route, $limit, $page); |
|
| 47 | } |
||
| 48 | } |