| @@ 510-523 (lines=14) @@ | ||
| 507 | * |
|
| 508 | * @return bool Whether or not $str starts with $substring |
|
| 509 | */ |
|
| 510 | public function startsWithAny(array $substrings, $caseSensitive = true) |
|
| 511 | { |
|
| 512 | if (empty($substrings)) { |
|
| 513 | return false; |
|
| 514 | } |
|
| 515 | ||
| 516 | foreach ($substrings as $substring) { |
|
| 517 | if ($this->startsWith($substring, $caseSensitive)) { |
|
| 518 | return true; |
|
| 519 | } |
|
| 520 | } |
|
| 521 | ||
| 522 | return false; |
|
| 523 | } |
|
| 524 | ||
| 525 | /** |
|
| 526 | * Ensures that the string ends with $substring. If it doesn't, it's |
|
| @@ 584-597 (lines=14) @@ | ||
| 581 | * case-sensitivity |
|
| 582 | * @return bool Whether or not $str ends with $substring |
|
| 583 | */ |
|
| 584 | public function endsWithAny($substrings, $caseSensitive = true) |
|
| 585 | { |
|
| 586 | if (empty($substrings)) { |
|
| 587 | return false; |
|
| 588 | } |
|
| 589 | ||
| 590 | foreach ($substrings as $substring) { |
|
| 591 | if ($this->endsWith($substring, $caseSensitive)) { |
|
| 592 | return true; |
|
| 593 | } |
|
| 594 | } |
|
| 595 | ||
| 596 | return false; |
|
| 597 | } |
|
| 598 | ||
| 599 | /** |
|
| 600 | * Returns the first $n characters of the string. |
|