Completed
Push — master ( 269470...f117d4 )
by Paweł
08:47
created

Filter::getCriteria()   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 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
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 Sylius\Component\Grid\Definition;
13
14
/**
15
 * @author Paweł Jędrzejewski <[email protected]>
16
 */
17
class Filter
18
{
19
    /**
20
     * @var string
21
     */
22
    private $name;
23
24
    /**
25
     * @var string
26
     */
27
    private $type;
28
29
    /**
30
     * @var string
31
     */
32
    private $label;
33
34
    /**
35
     * @var boolean
36
     */
37
    private $enabled = true;
38
39
    /**
40
     * @var string
41
     */
42
    private $template;
43
44
    /**
45
     * @var array
46
     */
47
    private $options = [];
48
49
    /**
50
     * @var array
51
     */
52
    private $formOptions = [];
53
54
    /**
55
     * @var mixed
56
     */
57
    private $criteria;
58
59
    /**
60
     * @var int
61
     *
62
     * Position equals to 100 to ensure that wile sorting filters by position ASC
63
     * the filters positioned by default will be last
64
     */
65
    private $position = 100;
66
67
    /**
68
     * @param string $name
69
     * @param string $type
70
     */
71
    private function __construct($name, $type)
72
    {
73
        $this->name = $name;
74
        $this->type = $type;
75
76
        $this->label = $name;
77
    }
78
79
    /**
80
     * @param string $name
81
     * @param string $type
82
     *
83
     * @return self
84
     */
85
    public static function fromNameAndType($name, $type)
86
    {
87
        return new self($name, $type);
88
    }
89
90
    /**
91
     * @return string
92
     */
93
    public function getName()
94
    {
95
        return $this->name;
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    public function getType()
102
    {
103
        return $this->type;
104
    }
105
106
    /**
107
     * @return string
108
     */
109
    public function getLabel()
110
    {
111
        return $this->label;
112
    }
113
114
    /**
115
     * @param string $label
116
     */
117
    public function setLabel($label)
118
    {
119
        $this->label = $label;
120
    }
121
122
    /**
123
     * @return boolean
124
     */
125
    public function isEnabled()
126
    {
127
        return $this->enabled;
128
    }
129
130
    /**
131
     * @param boolean $enabled
132
     */
133
    public function setEnabled($enabled)
134
    {
135
        $this->enabled = $enabled;
136
    }
137
138
    /**
139
     * @return string
140
     */
141
    public function getTemplate()
142
    {
143
        return $this->template;
144
    }
145
146
    /**
147
     * @param string $template
148
     */
149
    public function setTemplate($template)
150
    {
151
        $this->template = $template;
152
    }
153
154
    /**
155
     * @return array
156
     */
157
    public function getOptions()
158
    {
159
        return $this->options;
160
    }
161
162
    /**
163
     * @param array $options
164
     */
165
    public function setOptions($options)
166
    {
167
        $this->options = $options;
168
    }
169
170
    /**
171
     * @return array
172
     */
173
    public function getFormOptions()
174
    {
175
        return $this->formOptions;
176
    }
177
178
    /**
179
     * @param array $formOptions
180
     */
181
    public function setFormOptions($formOptions)
182
    {
183
        $this->formOptions = $formOptions;
184
    }
185
186
    /**
187
     * @return int
188
     */
189
    public function getPosition()
190
    {
191
        return $this->position;
192
    }
193
194
    /**
195
     * @param int $position
196
     */
197
    public function setPosition($position)
198
    {
199
        $this->position = $position;
200
    }
201
202
    /**
203
     * @return mixed
204
     */
205
    public function getCriteria()
206
    {
207
        return $this->criteria;
208
    }
209
210
    /**
211
     * @param mixed $criteria
212
     */
213
    public function setCriteria($criteria)
214
    {
215
        $this->criteria = $criteria;
216
    }
217
}
218