| @@ 347-361 (lines=15) @@ | ||
| 344 | * |
|
| 345 | * @return bool <p>Whether or not $str contains $needle.</p> |
|
| 346 | */ |
|
| 347 | public function containsAll(array $needles, bool $caseSensitive = true): bool |
|
| 348 | { |
|
| 349 | /** @noinspection IsEmptyFunctionUsageInspection */ |
|
| 350 | if (empty($needles)) { |
|
| 351 | return false; |
|
| 352 | } |
|
| 353 | ||
| 354 | foreach ($needles as $needle) { |
|
| 355 | if (!$this->contains($needle, $caseSensitive)) { |
|
| 356 | return false; |
|
| 357 | } |
|
| 358 | } |
|
| 359 | ||
| 360 | return true; |
|
| 361 | } |
|
| 362 | ||
| 363 | /** |
|
| 364 | * Returns true if the string contains $needle, false otherwise. By default |
|
| @@ 394-408 (lines=15) @@ | ||
| 391 | * |
|
| 392 | * @return bool <p>Whether or not $str contains $needle.</p> |
|
| 393 | */ |
|
| 394 | public function containsAny(array $needles, bool $caseSensitive = true): bool |
|
| 395 | { |
|
| 396 | /** @noinspection IsEmptyFunctionUsageInspection */ |
|
| 397 | if (empty($needles)) { |
|
| 398 | return false; |
|
| 399 | } |
|
| 400 | ||
| 401 | foreach ($needles as $needle) { |
|
| 402 | if ($this->contains($needle, $caseSensitive)) { |
|
| 403 | return true; |
|
| 404 | } |
|
| 405 | } |
|
| 406 | ||
| 407 | return false; |
|
| 408 | } |
|
| 409 | ||
| 410 | /** |
|
| 411 | * Returns the length of the string, implementing the countable interface. |
|