1 | <?php |
||
10 | final 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 | * @return Expression |
||
45 | * @throws \InvalidArgumentException |
||
46 | */ |
||
47 | public function isTrue(): Expression |
||
51 | |||
52 | /** |
||
53 | * @return Expression |
||
54 | * @throws \InvalidArgumentException |
||
55 | */ |
||
56 | public function isFalse(): Expression |
||
60 | |||
61 | /** |
||
62 | * @param array $values |
||
63 | * @param null|string $placeholder |
||
64 | * @param string $glue |
||
65 | * @return Expression |
||
66 | * @throws \InvalidArgumentException |
||
67 | */ |
||
68 | public function in(array $values, ?string $placeholder = '?', string $glue = ', '): Expression |
||
73 | |||
74 | /** |
||
75 | * @param array $values |
||
76 | * @param string $placeholder |
||
77 | * @param string $glue |
||
78 | * @return Expression |
||
79 | * @throws \InvalidArgumentException |
||
80 | */ |
||
81 | public function notIn(array $values, ?string $placeholder = '?', string $glue = ', '): Expression |
||
86 | |||
87 | /** |
||
88 | * @param $value |
||
89 | * @param string $placeholder |
||
90 | * @return Expression |
||
91 | * @throws \InvalidArgumentException |
||
92 | */ |
||
93 | public function equals($value, ?string $placeholder = '?'): Expression |
||
98 | |||
99 | /** |
||
100 | * @param $value |
||
101 | * @param string $placeholder |
||
102 | * @return Expression |
||
103 | * @throws \InvalidArgumentException |
||
104 | */ |
||
105 | public function notEquals($value, ?string $placeholder = '?'): Expression |
||
110 | |||
111 | /** |
||
112 | * @param $value |
||
113 | * @param string $placeholder |
||
114 | * @return Expression |
||
115 | * @throws \InvalidArgumentException |
||
116 | */ |
||
117 | public function lt($value, ?string $placeholder = '?'): Expression |
||
122 | |||
123 | /** |
||
124 | * @param $value |
||
125 | * @param string $placeholder |
||
126 | * @return Expression |
||
127 | * @throws \InvalidArgumentException |
||
128 | */ |
||
129 | public function lte($value, ?string $placeholder = '?'): Expression |
||
134 | |||
135 | /** |
||
136 | * @param $value |
||
137 | * @param string $placeholder |
||
138 | * @return Expression |
||
139 | * @throws \InvalidArgumentException |
||
140 | */ |
||
141 | public function gt($value, ?string $placeholder = '?'): Expression |
||
146 | |||
147 | /** |
||
148 | * @param $value |
||
149 | * @param string $placeholder |
||
150 | * @return Expression |
||
151 | * @throws \InvalidArgumentException |
||
152 | */ |
||
153 | public function gte($value, ?string $placeholder = '?'): Expression |
||
158 | |||
159 | /** |
||
160 | * @param $start |
||
161 | * @param $end |
||
162 | * @param string $placeholder |
||
163 | * @return Expression |
||
164 | * @throws \InvalidArgumentException |
||
165 | */ |
||
166 | public function between($start, $end, ?string $placeholder = '?'): Expression |
||
171 | |||
172 | /** |
||
173 | * @param $start |
||
174 | * @param $end |
||
175 | * @param string $placeholder |
||
176 | * @return Expression |
||
177 | * @throws \InvalidArgumentException |
||
178 | */ |
||
179 | public function notBetween($start, $end, ?string $placeholder = '?'): Expression |
||
184 | |||
185 | /** |
||
186 | * @param string $value |
||
187 | * @param string $placeholder |
||
188 | * @param string $surroundWith |
||
189 | * @return Expression |
||
190 | * @throws \InvalidArgumentException |
||
191 | */ |
||
192 | public function like(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
198 | |||
199 | /** |
||
200 | * @param string $value |
||
201 | * @param string $placeholder |
||
202 | * @param string $surroundWith |
||
203 | * @return Expression |
||
204 | * @throws \InvalidArgumentException |
||
205 | */ |
||
206 | public function notLike(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
212 | |||
213 | /** |
||
214 | * @param string $value |
||
215 | * @param string $placeholder |
||
216 | * @param string $surroundWith |
||
217 | * @return Expression |
||
218 | * @throws \InvalidArgumentException |
||
219 | */ |
||
220 | public function startsWith(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
226 | |||
227 | /** |
||
228 | * @param string $value |
||
229 | * @param string $placeholder |
||
230 | * @param string $surroundWith |
||
231 | * @return Expression |
||
232 | * @throws \InvalidArgumentException |
||
233 | */ |
||
234 | public function notStartsWith(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
240 | |||
241 | /** |
||
242 | * @param string $value |
||
243 | * @param string $placeholder |
||
244 | * @param string $surroundWith |
||
245 | * @return Expression |
||
246 | * @throws \InvalidArgumentException |
||
247 | */ |
||
248 | public function endsWith(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
254 | |||
255 | /** |
||
256 | * @param string $value |
||
257 | * @param string $placeholder |
||
258 | * @param string $surroundWith |
||
259 | * @return Expression |
||
260 | * @throws \InvalidArgumentException |
||
261 | */ |
||
262 | public function notEndsWith(string $value, ?string $placeholder = '?', string $surroundWith = '%'): Expression |
||
268 | } |
||
269 |