Conditions | 9 |
Paths | 7 |
Total Lines | 22 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 9 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
5636 | 45 | public static function str_contains_all( |
|
5637 | string $haystack, |
||
5638 | array $needles, |
||
5639 | bool $case_sensitive = true |
||
5640 | ): bool { |
||
5641 | 45 | if ($haystack === '' || $needles === []) { |
|
5642 | 1 | return false; |
|
5643 | } |
||
5644 | |||
5645 | 44 | foreach ($needles as &$needle) { |
|
5646 | 44 | if ($case_sensitive) { |
|
5647 | 24 | if (!$needle || \strpos($haystack, $needle) === false) { |
|
5648 | 12 | return false; |
|
5649 | } |
||
5650 | } |
||
5651 | |||
5652 | 33 | if (!$needle || \mb_stripos($haystack, $needle) === false) { |
|
5653 | 8 | return false; |
|
5654 | } |
||
5655 | } |
||
5656 | |||
5657 | 24 | return true; |
|
5658 | } |
||
13694 |