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.4 (#141)
by Alessandro
08:47 queued 02:39
created

PagerfantaBuilder::createRepresentation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
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
    public function __construct(PagerfantaFactory $pagerfantaFactory, DoctrineORMAdapter $ormAdapter)
16
    {
17
        $this->pagerfantaFactory = $pagerfantaFactory;
18
        $this->ormAdapter = $ormAdapter;
19
    }
20
21
    public function create($limit, $page) :Pagerfanta
22
    {
23
        $pager = new Pagerfanta($this->ormAdapter);
24
        $pager->setNormalizeOutOfRangePages(true);
25
        $pager->setMaxPerPage($limit);
26
        $pager->setCurrentPage($page);
27
28
        return $pager;
29
    }
30
31
    public function createRepresentation($route, $limit, $page)
32
    {
33
        $pager = $this->create(
34
            $limit,
35
            $page
36
        );
37
38
        return $this->pagerfantaFactory->createRepresentation($pager, $route);
39
    }
40
}
41