1 | <?php |
||
10 | class FieldHelper |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $field; |
||
16 | |||
17 | /** |
||
18 | * Field constructor. |
||
19 | */ |
||
20 | public function __construct(string $field) |
||
24 | |||
25 | /** |
||
26 | * @return Expression |
||
27 | * @throws \InvalidArgumentException |
||
28 | */ |
||
29 | public function isNull(): Expression |
||
33 | |||
34 | /** |
||
35 | * @return Expression |
||
36 | * @throws \InvalidArgumentException |
||
37 | */ |
||
38 | public function isNotNull(): Expression |
||
42 | |||
43 | /** |
||
44 | * @param array $values |
||
45 | * @param null|string $placeholder |
||
46 | * @param string $glue |
||
47 | * @return Expression |
||
48 | * @throws \InvalidArgumentException |
||
49 | */ |
||
50 | public function in(array $values, ?string $placeholder = '?', string $glue = ', '): Expression |
||
55 | |||
56 | /** |
||
57 | * @param array $values |
||
58 | * @param string $placeholder |
||
59 | * @param string $glue |
||
60 | * @return Expression |
||
61 | * @throws \InvalidArgumentException |
||
62 | */ |
||
63 | public function notIn(array $values, ?string $placeholder = '?', string $glue = ', '): Expression |
||
68 | |||
69 | /** |
||
70 | * @param $value |
||
71 | * @param string $placeholder |
||
72 | * @return Expression |
||
73 | * @throws \InvalidArgumentException |
||
74 | */ |
||
75 | public function equals($value, ?string $placeholder = '?'): Expression |
||
80 | |||
81 | /** |
||
82 | * @param $value |
||
83 | * @param string $placeholder |
||
84 | * @return Expression |
||
85 | * @throws \InvalidArgumentException |
||
86 | */ |
||
87 | public function notEquals($value, ?string $placeholder = '?'): Expression |
||
92 | |||
93 | /** |
||
94 | * @param $value |
||
95 | * @param string $placeholder |
||
96 | * @return Expression |
||
97 | * @throws \InvalidArgumentException |
||
98 | */ |
||
99 | public function lt($value, ?string $placeholder = '?'): Expression |
||
104 | |||
105 | /** |
||
106 | * @param $value |
||
107 | * @param string $placeholder |
||
108 | * @return Expression |
||
109 | * @throws \InvalidArgumentException |
||
110 | */ |
||
111 | public function lte($value, ?string $placeholder = '?'): Expression |
||
116 | |||
117 | /** |
||
118 | * @param $value |
||
119 | * @param string $placeholder |
||
120 | * @return Expression |
||
121 | * @throws \InvalidArgumentException |
||
122 | */ |
||
123 | public function gt($value, ?string $placeholder = '?'): Expression |
||
128 | |||
129 | /** |
||
130 | * @param $value |
||
131 | * @param string $placeholder |
||
132 | * @return Expression |
||
133 | * @throws \InvalidArgumentException |
||
134 | */ |
||
135 | public function gte($value, ?string $placeholder = '?'): Expression |
||
140 | |||
141 | /** |
||
142 | * @param $start |
||
143 | * @param $end |
||
144 | * @param string $placeholder |
||
145 | * @return Expression |
||
146 | * @throws \InvalidArgumentException |
||
147 | */ |
||
148 | public function between($start, $end, ?string $placeholder = '?'): Expression |
||
153 | |||
154 | /** |
||
155 | * @param $start |
||
156 | * @param $end |
||
157 | * @param string $placeholder |
||
158 | * @return Expression |
||
159 | * @throws \InvalidArgumentException |
||
160 | */ |
||
161 | public function notBetween($start, $end, ?string $placeholder = '?'): Expression |
||
166 | |||
167 | /** |
||
168 | * @param string $value |
||
169 | * @param string $placeholder |
||
170 | * @param string $surroundWith |
||
171 | * @return Expression |
||
172 | * @throws \InvalidArgumentException |
||
173 | */ |
||
174 | public function like(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
180 | |||
181 | /** |
||
182 | * @param string $value |
||
183 | * @param string $placeholder |
||
184 | * @param string $surroundWith |
||
185 | * @return Expression |
||
186 | * @throws \InvalidArgumentException |
||
187 | */ |
||
188 | public function notLike(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
194 | |||
195 | /** |
||
196 | * @param string $value |
||
197 | * @param string $placeholder |
||
198 | * @param string $surroundWith |
||
199 | * @return Expression |
||
200 | * @throws \InvalidArgumentException |
||
201 | */ |
||
202 | public function startsWith(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
208 | |||
209 | /** |
||
210 | * @param string $value |
||
211 | * @param string $placeholder |
||
212 | * @param string $surroundWith |
||
213 | * @return Expression |
||
214 | * @throws \InvalidArgumentException |
||
215 | */ |
||
216 | public function notStartsWith(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
222 | |||
223 | /** |
||
224 | * @param string $value |
||
225 | * @param string $placeholder |
||
226 | * @param string $surroundWith |
||
227 | * @return Expression |
||
228 | * @throws \InvalidArgumentException |
||
229 | */ |
||
230 | public function endsWith(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
236 | |||
237 | /** |
||
238 | * @param string $value |
||
239 | * @param string $placeholder |
||
240 | * @param string $surroundWith |
||
241 | * @return Expression |
||
242 | * @throws \InvalidArgumentException |
||
243 | */ |
||
244 | public function notEndsWith(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
250 | } |
||
251 |