| @@ 525-538 (lines=14) @@ | ||
| 522 | * |
|
| 523 | * @return bool Whether or not $str starts with $substring |
|
| 524 | */ |
|
| 525 | public function startsWithAny(array $substrings, $caseSensitive = true) |
|
| 526 | { |
|
| 527 | if (empty($substrings)) { |
|
| 528 | return false; |
|
| 529 | } |
|
| 530 | ||
| 531 | foreach ($substrings as $substring) { |
|
| 532 | if ($this->startsWith($substring, $caseSensitive)) { |
|
| 533 | return true; |
|
| 534 | } |
|
| 535 | } |
|
| 536 | ||
| 537 | return false; |
|
| 538 | } |
|
| 539 | ||
| 540 | /** |
|
| 541 | * Ensures that the string ends with $substring. If it doesn't, it's |
|
| @@ 600-613 (lines=14) @@ | ||
| 597 | * |
|
| 598 | * @return bool Whether or not $str ends with $substring |
|
| 599 | */ |
|
| 600 | public function endsWithAny($substrings, $caseSensitive = true) |
|
| 601 | { |
|
| 602 | if (empty($substrings)) { |
|
| 603 | return false; |
|
| 604 | } |
|
| 605 | ||
| 606 | foreach ($substrings as $substring) { |
|
| 607 | if ($this->endsWith($substring, $caseSensitive)) { |
|
| 608 | return true; |
|
| 609 | } |
|
| 610 | } |
|
| 611 | ||
| 612 | return false; |
|
| 613 | } |
|
| 614 | ||
| 615 | /** |
|
| 616 | * Returns the first $n characters of the string. |
|