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

Pager   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 12
lcom 1
cbo 1
dl 0
loc 62
rs 10
c 0
b 0
f 0

12 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A init() 0 3 1
A getMaxPerPage() 0 4 1
A setMaxPerPage() 0 3 1
A setPage() 0 3 1
A setQuery() 0 3 1
A getResults() 0 4 1
A setMaxPageLinks() 0 3 1
A getMaxPageLinks() 0 4 1
A getPage() 0 4 1
A isLastPage() 0 4 1
A getNbResults() 0 4 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