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 |
||
5665 | public static function str_contains_all( |
||
5666 | string $haystack, |
||
5667 | array $needles, |
||
5668 | bool $case_sensitive = true |
||
5669 | ): bool { |
||
5670 | 45 | if ($haystack === '' || $needles === []) { |
|
5671 | 1 | return false; |
|
5672 | } |
||
5673 | |||
5674 | 44 | foreach ($needles as &$needle) { |
|
5675 | 44 | if ($case_sensitive) { |
|
5676 | 24 | if (!$needle || \strpos($haystack, $needle) === false) { |
|
5677 | 12 | return false; |
|
5678 | } |
||
5679 | } |
||
5680 | |||
5681 | 33 | if (!$needle || \mb_stripos($haystack, $needle) === false) { |
|
5682 | 33 | return false; |
|
5683 | } |
||
5684 | } |
||
5685 | |||
5686 | 24 | return true; |
|
5687 | } |
||
13723 |