Completed
Push — master ( df0c76...851a92 )
by Arnaud
12s
created

PagerfantaFilter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 50%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A filter() 0 8 2
A getCurrentPage() 0 4 1
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 = 1;
15
16 8
    /**
17
     * Filter request
18 8
     *
19
     * @param Request $request
20 8
     */
21
    public function filter(Request $request)
22 8
    {
23
        if ($request->get('page')) {
24 8
            $this->currentPage = $request->get('page');
25
        }
26 8
        // filter normal request parameters
27
        parent::filter($request);
28
    }
29
30
    /**
31
     * Return the current page that should be retrieved by the pager
32
     *
33
     * @return int
34 8
     */
35
    public function getCurrentPage()
36
    {
37 8
        return $this->currentPage;
38
    }
39
}
40