@@ 157-176 (lines=20) @@ | ||
154 | } |
|
155 | } |
|
156 | ||
157 | if (!function_exists('ends_with_insensitive')) { |
|
158 | /** |
|
159 | * Determine if a given string ends with a given substring (case insensitive). |
|
160 | * |
|
161 | * @param string $haystack |
|
162 | * @param string|array $needles |
|
163 | * @return bool |
|
164 | */ |
|
165 | function ends_with_insensitive($haystack, $needles) |
|
166 | { |
|
167 | if (isNullOrEmpty($haystack) || isNullOrEmpty($needles)) { |
|
168 | return false; |
|
169 | } |
|
170 | ||
171 | $haystack = strtolower($haystack); |
|
172 | $needles = strtolower($needles); |
|
173 | ||
174 | return ends_with($haystack, $needles); |
|
175 | } |
|
176 | } |
|
177 | ||
178 | if (!function_exists('starts_with')) { |
|
179 | /** |
|
@@ 201-220 (lines=20) @@ | ||
198 | } |
|
199 | } |
|
200 | ||
201 | if (!function_exists('starts_with_insensitive')) { |
|
202 | /** |
|
203 | * Determine if a given string starts with a given substring (case insensitive). |
|
204 | * |
|
205 | * @param string $haystack |
|
206 | * @param string|array $needles |
|
207 | * @return bool |
|
208 | */ |
|
209 | function starts_with_insensitive($haystack, $needles) |
|
210 | { |
|
211 | if (isNullOrEmpty($haystack) || (!is_array($needles) && isNullOrEmpty($needles))) { |
|
212 | return false; |
|
213 | } |
|
214 | ||
215 | $haystack = strtolower($haystack); |
|
216 | $needles = strtolower($needles); |
|
217 | ||
218 | return starts_with($haystack, $needles); |
|
219 | } |
|
220 | } |
|
221 | ||
222 | if (!function_exists('str_contains_array')) { |
|
223 | /** |
|
@@ 269-288 (lines=20) @@ | ||
266 | } |
|
267 | } |
|
268 | ||
269 | if (!function_exists('str_contains_insensitive')) { |
|
270 | /** |
|
271 | * Determine if a given string contains a given substring (case insensitive). |
|
272 | * |
|
273 | * @param string $haystack |
|
274 | * @param string|array $needles |
|
275 | * @return bool |
|
276 | */ |
|
277 | function str_contains_insensitive($haystack, $needles) |
|
278 | { |
|
279 | if (isNullOrEmpty($haystack) || isNullOrEmpty($needles)) { |
|
280 | return false; |
|
281 | } |
|
282 | ||
283 | $haystack = strtolower($haystack); |
|
284 | $needles = strtolower($needles); |
|
285 | ||
286 | return str_contains($haystack, $needles); |
|
287 | } |
|
288 | } |
|
289 | ||
290 | if (!function_exists('str_finish')) { |
|
291 | /** |
|
@@ 309-328 (lines=20) @@ | ||
306 | } |
|
307 | } |
|
308 | ||
309 | if (!function_exists('str_finish_insensitive')) { |
|
310 | /** |
|
311 | * Cap a string with a single instance of a given value (Case Insensitive). |
|
312 | * |
|
313 | * @param string $value |
|
314 | * @param string $cap |
|
315 | * @return string |
|
316 | */ |
|
317 | function str_finish_insensitive($value, $cap) |
|
318 | { |
|
319 | if (isNullOrEmpty($value) || isNullOrEmpty($cap)) { |
|
320 | return false; |
|
321 | } |
|
322 | ||
323 | $value = strtolower($value); |
|
324 | $cap = strtolower($cap); |
|
325 | ||
326 | return str_finish($value, $cap); |
|
327 | } |
|
328 | } |
|
329 | ||
330 | if (!function_exists('str_is')) { |
|
331 | /** |