PagerfantaPager::getNbPages()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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