Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public static function isArrayHasAllPropertiesFromClass(array $array, string $class): bool |
||
13 | { |
||
14 | try { |
||
15 | $rClass = new \ReflectionClass($class); |
||
16 | } catch (\ReflectionException) { |
||
17 | return false; |
||
18 | } |
||
19 | |||
20 | foreach ($rClass->getProperties() as $property) { |
||
21 | $propertyValue = $array[$property->getName()] ?? $array[StringHelper::toSnakeCase($property->getName())] ?? null; |
||
22 | |||
23 | if (!$propertyValue) { |
||
24 | return false; |
||
25 | } |
||
26 | } |
||
27 | |||
28 | return true; |
||
29 | } |
||
31 |