Completed
Pull Request — master (#71)
by Arnaud
14:19 queued 12:02
created

PagerfantaFilter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCurrentPage() 0 4 1
A filter() 0 8 2
1
<?php
2
3
namespace LAG\AdminBundle\Filter;
4
5
use Symfony\Component\HttpFoundation\Request;
6
7
class PagerfantaFilter extends RequestFilter
8
{
9
    /**
10
     * The current page that should be retrieved by the pager
11
     *
12
     * @var int
13
     */
14
    protected $currentPage;
15
16
    /**
17
     * Filter request
18
     *
19
     * @param Request $request
20
     */
21 1
    public function filter(Request $request)
22
    {
23 1
        if ($request->get('page')) {
24 1
            $this->currentPage = $request->get('page');
25
        }
26
        // filter normal request parameters
27 1
        parent::filter($request);
28 1
    }
29
30
    /**
31
     * Return the current page that should be retrieved by the pager
32
     *
33
     * @return int
34
     */
35 1
    public function getCurrentPage()
36
    {
37 1
        return $this->currentPage;
38
    }
39
}
40