Completed
Pull Request — 3.x (#6311)
by Vincent
04:23
created

Pager::setMaxPerPage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\AdminBundle\Tests\App\Datagrid;
15
16
use Sonata\AdminBundle\Datagrid\PagerInterface;
17
use Sonata\AdminBundle\Tests\App\Model\FooRepository;
18
19
final class Pager implements PagerInterface
20
{
21
    /**
22
     * @var FooRepository
23
     */
24
    private $repository;
25
26
    public function __construct(FooRepository $repository)
27
    {
28
        $this->repository = $repository;
29
    }
30
31
    public function init(): void
32
    {
33
    }
34
35
    public function getMaxPerPage()
36
    {
37
        return 1;
38
    }
39
40
    public function setMaxPerPage($max): void
41
    {
42
    }
43
44
    public function setPage($page): void
45
    {
46
    }
47
48
    public function setQuery($query): void
49
    {
50
    }
51
52
    public function getResults(): array
53
    {
54
        return $this->repository->all();
55
    }
56
57
    public function setMaxPageLinks($maxPageLinks): void
58
    {
59
    }
60
61
    public function getMaxPageLinks()
62
    {
63
        return 1;
64
    }
65
66
    public function getPage()
67
    {
68
        return 1;
69
    }
70
71
    public function isLastPage()
72
    {
73
        return true;
74
    }
75
76
    public function getNbResults()
77
    {
78
        return count($this->getResults());
79
    }
80
}
81