| @@ 68-76 (lines=9) @@ | ||
| 65 | * @param string|array $needles |
|
| 66 | * @return bool |
|
| 67 | */ |
|
| 68 | public static function endsWith($haystack, $needles) |
|
| 69 | { |
|
| 70 | foreach ((array)$needles as $needle) { |
|
| 71 | if (substr($haystack, -strlen($needle)) === (string)$needle) { |
|
| 72 | return true; |
|
| 73 | } |
|
| 74 | } |
|
| 75 | return false; |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * Cap a string with a single instance of a given value. |
|
| @@ 216-224 (lines=9) @@ | ||
| 213 | * @param string|array $needles |
|
| 214 | * @return bool |
|
| 215 | */ |
|
| 216 | public static function contains($haystack, $needles) |
|
| 217 | { |
|
| 218 | foreach ((array)$needles as $needle) { |
|
| 219 | if ($needle != '' && mb_strpos($haystack, $needle) !== false) { |
|
| 220 | return true; |
|
| 221 | } |
|
| 222 | } |
|
| 223 | return false; |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|
| 227 | * Get the plural form of an English word. |
|
| @@ 500-508 (lines=9) @@ | ||
| 497 | * @param string|array $needles |
|
| 498 | * @return bool |
|
| 499 | */ |
|
| 500 | public static function startsWith($haystack, $needles) |
|
| 501 | { |
|
| 502 | foreach ((array)$needles as $needle) { |
|
| 503 | if ($needle != '' && substr($haystack, 0, strlen($needle)) === (string)$needle) { |
|
| 504 | return true; |
|
| 505 | } |
|
| 506 | } |
|
| 507 | return false; |
|
| 508 | } |
|
| 509 | ||
| 510 | /** |
|
| 511 | * Make a string's first character uppercase. |
|