Completed
Push — master ( 3fc573...634850 )
by WEBEWEB
11:27
created

QueryBuilderValidation::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the jquery-querybuilder-bundle package.
5
 *
6
 * (c) 2017 WEBEWEB
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 WBW\Bundle\JQuery\QueryBuilderBundle\API;
13
14
use WBW\Bundle\JQuery\QueryBuilderBundle\Normalizer\QueryBuilderNormalizer;
15
16
/**
17
 * QueryBuilder validation.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Bundle\JQuery\QueryBuilderBundle\API
21
 */
22
class QueryBuilderValidation implements QueryBuilderValidationInterface {
23
24
    /**
25
     * Allow empty value.
26
     *
27
     * @var bool
28
     */
29
    private $allowEmptyValue;
30
31
    /**
32
     * Callback.
33
     *
34
     * @var string
35
     */
36
    private $callback;
37
38
    /**
39
     * Format.
40
     *
41
     * @var string|array
42
     */
43
    private $format;
44
45
    /**
46
     * Max.
47
     *
48
     * @var integer|float|string
49
     */
50
    private $max;
51
52
    /**
53
     * Messages.
54
     *
55
     * @var array
56
     */
57
    private $messages;
58
59
    /**
60
     * Min.
61
     *
62
     * @var integer|float|string
63
     */
64
    private $min;
65
66
    /**
67
     * Step.
68
     *
69
     * @var integer|float
70
     */
71
    private $step;
72
73
    /**
74
     * Constructor.
75
     */
76
    public function __construct() {
77
        // NOTHING TO DO.
78
    }
79
80
    /**
81
     * {@inheritDoc}
82
     */
83
    public function getAllowEmptyValue() {
84
        return $this->allowEmptyValue;
85
    }
86
87
    /**
88
     * {@inheritDoc}
89
     */
90
    public function getCallback() {
91
        return $this->callback;
92
    }
93
94
    /**
95
     * {@inheritDoc}
96
     */
97
    public function getFormat() {
98
        return $this->format;
99
    }
100
101
    /**
102
     * {@inheritDoc}
103
     */
104
    public function getMax() {
105
        return $this->max;
106
    }
107
108
    /**
109
     * {@inheritDoc}
110
     */
111
    public function getMessages() {
112
        return $this->messages;
113
    }
114
115
    /**
116
     * {@inheritDoc}
117
     */
118
    public function getMin() {
119
        return $this->min;
120
    }
121
122
    /**
123
     * {@inheritDoc}
124
     */
125
    public function getStep() {
126
        return $this->step;
127
    }
128
129
    /**
130
     * {@inheritDoc}
131
     */
132
    public function jsonSerialize() {
133
        return QueryBuilderNormalizer::normalizeQueryBuilderValidation($this);
134
    }
135
136
    /**
137
     * Set the allow empty value.
138
     *
139
     * @param bool $allowEmptyValue The allow empty value.
140
     * @return QueryBuilderValidationInterface Returns this validation.
141
     */
142
    public function setAllowEmptyValue($allowEmptyValue) {
143
        $this->allowEmptyValue = $allowEmptyValue;
144
        return $this;
145
    }
146
147
    /**
148
     * Set the callback.
149
     *
150
     * @param string $callback The callback.
151
     * @return QueryBuilderValidationInterface Returns this validation.
152
     */
153
    public function setCallback($callback) {
154
        $this->callback = $callback;
155
        return $this;
156
    }
157
158
    /**
159
     * Set the format.
160
     *
161
     * @param string|array $format The format.
162
     * @return QueryBuilderValidationInterface Returns this validation.
163
     */
164
    public function setFormat($format) {
165
        $this->format = $format;
166
        return $this;
167
    }
168
169
    /**
170
     * Set the max.
171
     *
172
     * @param integer|float|string $max The max.
173
     * @return QueryBuilderValidationInterface Returns this validation.
174
     */
175
    public function setMax($max) {
176
        $this->max = $max;
177
        return $this;
178
    }
179
180
    /**
181
     * Set the messages.
182
     *
183
     * @param array $messages The messages.
184
     * @return QueryBuilderValidationInterface Returns this validation.
185
     */
186
    public function setMessages(array $messages) {
187
        $this->messages = $messages;
188
        return $this;
189
    }
190
191
    /**
192
     * Set the min.
193
     *
194
     * @param integer|float|string $min The min.
195
     * @return QueryBuilderValidationInterface Returns this validation.
196
     */
197
    public function setMin($min) {
198
        $this->min = $min;
199
        return $this;
200
    }
201
202
    /**
203
     * Set the step.
204
     *
205
     * @param integer|float $step The step.
206
     * @return QueryBuilderValidationInterface Returns this validation.
207
     */
208
    public function setStep($step) {
209
        $this->step = $step;
210
        return $this;
211
    }
212
}
213