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 | * @param array $values |
||
27 | * @param string $placeholder |
||
28 | * @param string $glue |
||
29 | * @return Expression |
||
30 | * @throws \InvalidArgumentException |
||
31 | */ |
||
32 | public function in(array $values, string $placeholder = '?', string $glue = ', '): Expression |
||
36 | |||
37 | /** |
||
38 | * @param array $values |
||
39 | * @param string $placeholder |
||
40 | * @param string $glue |
||
41 | * @return Expression |
||
42 | * @throws \InvalidArgumentException |
||
43 | */ |
||
44 | public function notIn(array $values, string $placeholder = '?', string $glue = ', '): Expression |
||
48 | |||
49 | /** |
||
50 | * @param $value |
||
51 | * @param string $placeholder |
||
52 | * @return Expression |
||
53 | * @throws \InvalidArgumentException |
||
54 | */ |
||
55 | public function equals($value, string $placeholder = '?'): Expression |
||
59 | |||
60 | /** |
||
61 | * @param $value |
||
62 | * @param string $placeholder |
||
63 | * @return Expression |
||
64 | * @throws \InvalidArgumentException |
||
65 | */ |
||
66 | public function notEquals($value, string $placeholder = '?'): Expression |
||
70 | |||
71 | /** |
||
72 | * @param $value |
||
73 | * @param string $placeholder |
||
74 | * @return Expression |
||
75 | * @throws \InvalidArgumentException |
||
76 | */ |
||
77 | public function lt($value, string $placeholder = '?'): Expression |
||
81 | |||
82 | /** |
||
83 | * @param $value |
||
84 | * @param string $placeholder |
||
85 | * @return Expression |
||
86 | * @throws \InvalidArgumentException |
||
87 | */ |
||
88 | public function lte($value, string $placeholder = '?'): Expression |
||
92 | |||
93 | /** |
||
94 | * @param $value |
||
95 | * @param string $placeholder |
||
96 | * @return Expression |
||
97 | * @throws \InvalidArgumentException |
||
98 | */ |
||
99 | public function gt($value, string $placeholder = '?'): Expression |
||
103 | |||
104 | /** |
||
105 | * @param $value |
||
106 | * @param string $placeholder |
||
107 | * @return Expression |
||
108 | * @throws \InvalidArgumentException |
||
109 | */ |
||
110 | public function gte($value, string $placeholder = '?'): Expression |
||
114 | |||
115 | /** |
||
116 | * @param $start |
||
117 | * @param $end |
||
118 | * @param string $placeholder |
||
119 | * @return Expression |
||
120 | * @throws \InvalidArgumentException |
||
121 | */ |
||
122 | public function between($start, $end, string $placeholder = '?'): Expression |
||
126 | |||
127 | /** |
||
128 | * @param $start |
||
129 | * @param $end |
||
130 | * @param string $placeholder |
||
131 | * @return Expression |
||
132 | * @throws \InvalidArgumentException |
||
133 | */ |
||
134 | public function notBetween($start, $end, string $placeholder = '?'): Expression |
||
138 | |||
139 | /** |
||
140 | * @param string $value |
||
141 | * @param string $placeholder |
||
142 | * @param string $surroundWith |
||
143 | * @return Expression |
||
144 | * @throws \InvalidArgumentException |
||
145 | */ |
||
146 | public function like(string $value, string $placeholder = '?', string $surroundWith = '%'): Expression |
||
150 | |||
151 | /** |
||
152 | * @param string $value |
||
153 | * @param string $placeholder |
||
154 | * @param string $surroundWith |
||
155 | * @return Expression |
||
156 | * @throws \InvalidArgumentException |
||
157 | */ |
||
158 | public function notLike(string $value, string $placeholder = '?', string $surroundWith = '%'): Expression |
||
162 | |||
163 | /** |
||
164 | * @param string $value |
||
165 | * @param string $placeholder |
||
166 | * @param string $surroundWith |
||
167 | * @return Expression |
||
168 | * @throws \InvalidArgumentException |
||
169 | */ |
||
170 | public function startsWith(string $value, string $placeholder = '?', string $surroundWith = '%'): Expression |
||
174 | |||
175 | /** |
||
176 | * @param string $value |
||
177 | * @param string $placeholder |
||
178 | * @param string $surroundWith |
||
179 | * @return Expression |
||
180 | * @throws \InvalidArgumentException |
||
181 | */ |
||
182 | public function notStartsWith(string $value, string $placeholder = '?', string $surroundWith = '%'): Expression |
||
186 | |||
187 | /** |
||
188 | * @param string $value |
||
189 | * @param string $placeholder |
||
190 | * @param string $surroundWith |
||
191 | * @return Expression |
||
192 | * @throws \InvalidArgumentException |
||
193 | */ |
||
194 | public function endsWith(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 notEndsWith(string $value, string $placeholder = '?', string $surroundWith = '%'): Expression |
||
210 | } |
||
211 |