Conditions | 9 |
Paths | 7 |
Total Lines | 22 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 9 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
5609 | public static function str_contains_all( |
||
5610 | string $haystack, |
||
5611 | array $needles, |
||
5612 | bool $case_sensitive = true |
||
5613 | ): bool { |
||
5614 | 45 | if ($haystack === '' || $needles === []) { |
|
5615 | 1 | return false; |
|
5616 | } |
||
5617 | |||
5618 | 44 | foreach ($needles as &$needle) { |
|
5619 | 44 | if ($case_sensitive) { |
|
5620 | 24 | if (!$needle || \strpos($haystack, $needle) === false) { |
|
5621 | 12 | return false; |
|
5622 | } |
||
5623 | } |
||
5624 | |||
5625 | 33 | if (!$needle || \mb_stripos($haystack, $needle) === false) { |
|
5626 | 33 | return false; |
|
5627 | } |
||
5628 | } |
||
5629 | |||
5630 | 24 | return true; |
|
5631 | } |
||
13665 |