| @@ 504-517 (lines=14) @@ | ||
| 501 | * |
|
| 502 | * @return bool Whether or not $str starts with $substring |
|
| 503 | */ |
|
| 504 | public function startsWithAny(array $substrings, $caseSensitive = true) |
|
| 505 | { |
|
| 506 | if (empty($substrings)) { |
|
| 507 | return false; |
|
| 508 | } |
|
| 509 | ||
| 510 | foreach ($substrings as $substring) { |
|
| 511 | if ($this->startsWith($substring, $caseSensitive)) { |
|
| 512 | return true; |
|
| 513 | } |
|
| 514 | } |
|
| 515 | ||
| 516 | return false; |
|
| 517 | } |
|
| 518 | ||
| 519 | /** |
|
| 520 | * Ensures that the string ends with $substring. If it doesn't, it's |
|
| @@ 578-591 (lines=14) @@ | ||
| 575 | * case-sensitivity |
|
| 576 | * @return bool Whether or not $str ends with $substring |
|
| 577 | */ |
|
| 578 | public function endsWithAny($substrings, $caseSensitive = true) |
|
| 579 | { |
|
| 580 | if (empty($substrings)) { |
|
| 581 | return false; |
|
| 582 | } |
|
| 583 | ||
| 584 | foreach ($substrings as $substring) { |
|
| 585 | if ($this->endsWith($substring, $caseSensitive)) { |
|
| 586 | return true; |
|
| 587 | } |
|
| 588 | } |
|
| 589 | ||
| 590 | return false; |
|
| 591 | } |
|
| 592 | ||
| 593 | /** |
|
| 594 | * Returns the first $n characters of the string. |
|