GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Pull Request — 2.2 (#165)
by Simone
03:19 queued 30s
created

Pager::setRouter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
namespace Mado\QueryBundle\Services;
4
5
use Mado\QueryBundle\Objects\PagerfantaBuilder;
6
use Mado\QueryBundle\Queries\QueryBuilderOptions;
7
use Pagerfanta\Adapter\DoctrineORMAdapter;
8
9
class Pager
10
{
11
    private const DEFAULT_LIMIT = 10;
12
13
    private const DEFAULT_PAGE = 1;
14
15
    private const DEFAULT_LIFETIME = 600;
16
17
    private $router;
18
19
    public function __construct()
20
    {
21
        $this->setRouter(new Router());
22
    }
23
24
    public function setRouter(Router $router)
25
    {
26
        $this->router = $router;
27
    }
28
29
    public function paginateResults (
30
        QueryBuilderOptions $queryOptions,
31
        DoctrineORMAdapter $ormAdapter,
32
        PagerfantaBuilder $pagerfantaBuilder,
33
        $routeName,
34
        $useResultCache
35
    ) {
36
        $limit = $queryOptions->get('limit', self::DEFAULT_LIMIT);
37
        $page = $queryOptions->get('page', self::DEFAULT_PAGE);
38
39
        $query = $ormAdapter->getQuery();
40
        if (isset($useResultCache) && $useResultCache) {
41
            $query->useResultCache(true, self::DEFAULT_LIFETIME);
42
        }
43
44
        $route = $this->router->createRouter($queryOptions, $routeName);
45
46
        return $pagerfantaBuilder->createRepresentation($route, $limit, $page);
47
    }
48
}