Conditions | 5 |
Paths | 6 |
Total Lines | 8 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
43 | 15 | private function useRule(string $field, array $data, array $optionalFields, bool $strict): bool |
|
44 | { |
||
45 | 15 | if (!in_array($field, $optionalFields)) { |
|
46 | 4 | return true; |
|
47 | } |
||
48 | |||
49 | 11 | return ($strict && ArrayHelper::pathExists($data, $field)) || |
|
50 | 11 | (!$strict && !empty(ArrayHelper::getValueByPath($data, $field))); |
|
51 | } |
||
53 |