Issues (117)

Grid/Pager/GridSourcePager.php (2 issues)

1
<?php
2
3
namespace Dtc\GridBundle\Grid\Pager;
4
5
use Dtc\GridBundle\Grid\Source\GridSourceInterface;
6
7
class GridSourcePager extends Pager
8
{
9
    private $gridSource;
10
    private $totalPages;
0 ignored issues
show
The private property $totalPages is not used, and could be removed.
Loading history...
11
12
    public function __construct(GridSourceInterface $gridSource)
13
    {
14
        $this->gridSource = $gridSource;
15
    }
16
17
    public function getCurrentPage()
18
    {
19
        $limit = $this->gridSource->getLimit();
20
        $offset = $this->gridSource->getOffset();
21
22
        if (!$limit) {
23
            return $offset;
24
        }
25
26
        return ceil(($offset / $limit) + 1);
27
    }
28
29
    public function getTotalPages()
30
    {
31
        $limit = $this->gridSource->getLimit();
32
        if (!$limit) {
33
            return $this->gridSource->getCount();
34
        }
35
36
        return ceil($this->gridSource->getCount() / $limit);
37
    }
38
39
    public function getRange($delta)
0 ignored issues
show
The parameter $delta is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

39
    public function getRange(/** @scrutinizer ignore-unused */ $delta)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
    {
41
    }
42
}
43