Completed
Push — master ( 7d3672...a34d6f )
by Simonas
357:48 queued 292:56
created

FilterState::isActive()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\FilterManagerBundle\Filter;
13
14
use ONGR\FilterManagerBundle\SerializableInterface;
15
16
/**
17
 * This class defines data structure to represent filter state.
18
 */
19
class FilterState implements SerializableInterface
20
{
21
    /**
22
     * @var bool True if filter is currently.
23
     */
24
    private $active = false;
25
26
    /**
27
     * @var mixed Represents user selected value for filtering.
28
     */
29
    private $value;
30
31
    /**
32
     * @var array Url parameters related *only* to given filter.
33
     */
34
    private $urlParameters = [];
35
36
    /**
37
     * @var string Filter name.
38
     */
39
    private $name;
40
41
    /**
42
     * @return bool
43
     */
44
    public function isActive()
45
    {
46
        return $this->active;
47
    }
48
49
    /**
50
     * @param bool $active
51
     */
52
    public function setActive($active)
53
    {
54
        $this->active = $active;
55
    }
56
57
    /**
58
     * @return mixed
59
     */
60
    public function getValue()
61
    {
62
        return $this->value;
63
    }
64
65
    /**
66
     * @param mixed $value
67
     */
68
    public function setValue($value)
69
    {
70
        $this->value = $value;
71
    }
72
73
    /**
74
     * @return array
75
     */
76
    public function getUrlParameters()
77
    {
78
        return $this->urlParameters;
79
    }
80
81
    /**
82
     * @param array $urlParameters
83
     */
84
    public function setUrlParameters(array $urlParameters)
85
    {
86
        $this->urlParameters = $urlParameters;
87
    }
88
89
    /**
90
     * @return string
91
     */
92
    public function getName()
93
    {
94
        return $this->name;
95
    }
96
97
    /**
98
     * @param string $name
99
     */
100
    public function setName($name)
101
    {
102
        $this->name = $name;
103
    }
104
105
    /**
106
     * {@inheritdoc}
107
     */
108
    public function getSerializableData()
109
    {
110
        return [
111
            'active' => $this->active,
112
            'value' => $this->value,
113
        ];
114
    }
115
}
116