| @@ 71-80 (lines=10) @@ | ||
| 68 | * |
|
| 69 | * @return bool |
|
| 70 | */ |
|
| 71 | public static function contains($haystack, $needles) |
|
| 72 | { |
|
| 73 | foreach ((array) $needles as $needle) { |
|
| 74 | if ($needle != '' && strpos($haystack, $needle) !== false) { |
|
| 75 | return true; |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||
| 79 | return false; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Determine if a given string ends with a given substring. |
|
| @@ 90-99 (lines=10) @@ | ||
| 87 | * |
|
| 88 | * @return bool |
|
| 89 | */ |
|
| 90 | public static function endsWith($haystack, $needles) |
|
| 91 | { |
|
| 92 | foreach ((array) $needles as $needle) { |
|
| 93 | if ((string) $needle === substr($haystack, -strlen($needle))) { |
|
| 94 | return true; |
|
| 95 | } |
|
| 96 | } |
|
| 97 | ||
| 98 | return false; |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * Cap a string with a single instance of a given value. |
|
| @@ 425-434 (lines=10) @@ | ||
| 422 | * |
|
| 423 | * @return bool |
|
| 424 | */ |
|
| 425 | public static function startsWith($haystack, $needles) |
|
| 426 | { |
|
| 427 | foreach ((array) $needles as $needle) { |
|
| 428 | if ($needle != '' && strpos($haystack, $needle) === 0) { |
|
| 429 | return true; |
|
| 430 | } |
|
| 431 | } |
|
| 432 | ||
| 433 | return false; |
|
| 434 | } |
|
| 435 | ||
| 436 | /** |
|
| 437 | * Convert a value to studly caps case. |
|