PagerfantaPager   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 90.48%

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 1
dl 0
loc 73
ccs 19
cts 21
cp 0.9048
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getNbResults() 0 4 1
A getNbPages() 0 4 1
A getCurrentPage() 0 4 1
A setCurrentPage() 0 4 1
A getMaxPerPage() 0 4 1
A setMaxPerPage() 0 4 1
A getCurrentPageResults() 0 4 1
A getPagerfanta() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the FOSElasticaBundle package.
5
 *
6
 * (c) FriendsOfSymfony <https://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\ElasticaBundle\Provider;
13
14
use Pagerfanta\Pagerfanta;
15
16
class PagerfantaPager implements PagerInterface
17
{
18
    /**
19
     * @var Pagerfanta
20
     */
21
    private $pagerfanta;
22
23 19
    public function __construct(Pagerfanta $pagerfanta)
24
    {
25 19
        $this->pagerfanta = $pagerfanta;
26 19
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getNbResults(): int
32
    {
33
        return $this->pagerfanta->getNbResults();
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 10
    public function getNbPages(): int
40
    {
41 10
        return $this->pagerfanta->getNbPages();
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47 10
    public function getCurrentPage(): int
48
    {
49 10
        return $this->pagerfanta->getCurrentPage();
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55 10
    public function setCurrentPage(int $page)
56
    {
57 10
        $this->pagerfanta->setCurrentPage($page);
58 10
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63 10
    public function getMaxPerPage(): int
64
    {
65 10
        return $this->pagerfanta->getMaxPerPage();
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71 10
    public function setMaxPerPage(int $perPage)
72
    {
73 10
        $this->pagerfanta->setMaxPerPage($perPage);
74 10
    }
75
76
    /**
77
     * {@inheritdoc}
78
     */
79 10
    public function getCurrentPageResults()
80
    {
81 10
        return $this->pagerfanta->getCurrentPageResults();
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->pagerfanta->getCurrentPageResults(); of type Pagerfanta\iterable|null adds the type Pagerfanta\iterable to the return on line 81 which is incompatible with the return type declared by the interface FOS\ElasticaBundle\Provi...::getCurrentPageResults of type array.
Loading history...
82
    }
83
84 3
    public function getPagerfanta(): Pagerfanta
85
    {
86 3
        return $this->pagerfanta;
87
    }
88
}
89