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.
Passed
Push — 2.3 ( 8686ea...f49551 )
by Simone
04:54
created

Pager::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 1
nc 1
nop 0
crap 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
    const DEFAULT_LIMIT = 10;
12
13
    const DEFAULT_PAGE = 1;
14
15
    const DEFAULT_LIFETIME = 600;
16
17
    private $router;
18
19 2
    public function __construct()
20
    {
21 2
        $this->setRouter(new Router());
22 2
    }
23
24 2
    public function setRouter(Router $router)
25
    {
26 2
        $this->router = $router;
27 2
    }
28
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
}
49