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

PagerfantaBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 14
dl 0
loc 30
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 8 1
A createRepresentation() 0 8 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