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
Pull Request — 2.2 (#165)
by Simone
10:05 queued 07:02
created

PagerfantaBuilder::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
c 0
b 0
f 0
ccs 6
cts 6
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Mado\QueryBundle\Objects;
4
5
use Hateoas\Representation\Factory\PagerfantaFactory;
6
use Pagerfanta\Adapter\DoctrineORMAdapter;
7
use Pagerfanta\Pagerfanta;
8
9
class PagerfantaBuilder
10
{
11
    private $pagerfantaFactory;
12
13
    private $ormAdapter;
14
15 1
    public function __construct(PagerfantaFactory $pagerfantaFactory, DoctrineORMAdapter $ormAdapter)
16
    {
17 1
        $this->pagerfantaFactory = $pagerfantaFactory;
18 1
        $this->ormAdapter = $ormAdapter;
19 1
    }
20
21 1
    public function create($limit, $page) :Pagerfanta
22
    {
23 1
        $pager = new Pagerfanta($this->ormAdapter);
24 1
        $pager->setNormalizeOutOfRangePages(true);
25 1
        $pager->setMaxPerPage($limit);
26 1
        $pager->setCurrentPage($page);
27
28 1
        return $pager;
29
    }
30
31 1
    public function createRepresentation($route, $limit, $page)
32
    {
33 1
        $pager = $this->create(
34
            $limit,
35
            $page
36
        );
37
38 1
        return $this->pagerfantaFactory->createRepresentation($pager, $route);
39
    }
40
}
41