Completed
Pull Request — master (#64)
by Daniel
02:07
created

FilterBar::getFilterUrlParameters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\Grid\View;
6
7
use Psi\Component\Grid\GridContext;
8
use Symfony\Component\Form\FormView;
9
10
class FilterBar
11
{
12
    private $form;
13
    private $options;
14
15
    public function __construct(FormView $form, GridContext $options)
16
    {
17
        $this->form = $form;
18
        $this->options = $options;
19
    }
20
21
    public function getForm(): FormView
22
    {
23
        return $this->form;
24
    }
25
26
    public function getUrlParametersForFilter()
27
    {
28
        return array_filter($this->options->getUrlParameters(), function ($key) {
29
            return $key !== 'filter';
30
        }, ARRAY_FILTER_USE_KEY);
31
    }
32
33
    public function getFilterUrlParameters()
34
    {
35
        return array_filter($this->options->getUrlParameters(), function ($key) {
36
            return $key === 'filter';
37
        }, ARRAY_FILTER_USE_KEY);
38
    }
39
}
40