Completed
Push — master ( 0d60f0...59f6cd )
by Simonas
166:06 queued 101:03
created

ChoiceAwareViewData::setUrlParameters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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\ViewData;
13
14
use ONGR\FilterManagerBundle\SerializableInterface;
15
16
/**
17
 * This class holds data for filter choice.
18
 */
19
class ChoiceAwareViewData implements SerializableInterface
20
{
21
    /**
22
     * @var bool
23
     */
24
    private $active = false;
25
26
    /**
27
     * @var bool
28
     */
29
    private $default = false;
30
31
    /**
32
     * @var array Holds set or unset parameters depending on state.
33
     */
34
    private $urlParameters = [];
35
36
    /**
37
     * @var string
38
     */
39
    private $label;
40
41
    /**
42
     * @var string Sorting any arrays: "min", "max", for only numeric arrays: "avg", "sum".
43
     */
44
    private $mode = null;
45
46
    /**
47
     * @var int Represents document count for option.
48
     */
49
    private $count = 0;
50
51
    /**
52
     * @return bool
53
     */
54
    public function isActive()
55
    {
56
        return $this->active;
57
    }
58
59
    /**
60
     * @param bool $active
61
     */
62
    public function setActive($active)
63
    {
64
        $this->active = $active;
65
    }
66
67
    /**
68
     * @return bool
69
     */
70
    public function isDefault()
71
    {
72
        return $this->default;
73
    }
74
75
    /**
76
     * @param bool $default
77
     */
78
    public function setDefault($default)
79
    {
80
        $this->default = $default;
81
    }
82
83
    /**
84
     * @return int
85
     */
86
    public function getCount()
87
    {
88
        return $this->count;
89
    }
90
91
    /**
92
     * @param int $count
93
     */
94
    public function setCount($count)
95
    {
96
        $this->count = $count;
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function getLabel()
103
    {
104
        return $this->label;
105
    }
106
107
    /**
108
     * @param string $label
109
     */
110
    public function setLabel($label)
111
    {
112
        $this->label = $label;
113
    }
114
115
    /**
116
     * @return array
117
     */
118
    public function getUrlParameters()
119
    {
120
        return $this->urlParameters;
121
    }
122
123
    /**
124
     * @param array $urlParameters
125
     */
126
    public function setUrlParameters($urlParameters)
127
    {
128
        $this->urlParameters = $urlParameters;
129
    }
130
131
    /**
132
     * @return string
133
     */
134
    public function getMode()
135
    {
136
        return $this->mode;
137
    }
138
139
    /**
140
     * @param string $mode
141
     */
142
    public function setMode($mode)
143
    {
144
        $this->mode = $mode;
145
    }
146
147
    /**
148
     * {@inheritdoc}
149
     */
150
    public function getSerializableData()
151
    {
152
        return [
153
            'active' => $this->isActive(),
154
            'default' => $this->isDefault(),
155
            'url_params' => $this->getUrlParameters(),
156
            'label' => $this->getLabel(),
157
            'mode' => $this->getMode(),
158
            'count' => $this->getCount(),
159
        ];
160
    }
161
}
162