Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
33 | 23 | public static function getPropertyMapping(string $className): array |
|
34 | { |
||
35 | try { |
||
36 | 23 | $properties = (new \ReflectionClass($className))->getProperties(); |
|
37 | 1 | } catch (\ReflectionException) { |
|
38 | 1 | $properties = []; |
|
39 | } |
||
40 | |||
41 | 23 | $map = static fn (\ReflectionProperty $p): array => [ |
|
42 | 22 | SerializerUtil::getSerializedNameAttribute($p)->getSerializedName() => $p->getType()?->getName(), |
|
|
|||
43 | ]; |
||
44 | |||
45 | 23 | return array_merge(...array_map($map, $properties)); |
|
46 | } |
||
58 |