| Conditions | 4 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4.016 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | 15 | private function extractConstraints(\ReflectionClass $rClass): array |
|
| 28 | { |
||
| 29 | 15 | $constraints = []; |
|
| 30 | |||
| 31 | 15 | if ($parentClass = $rClass->getParentClass()) { |
|
| 32 | $constraints = $this->extractConstraints($parentClass); |
||
| 33 | } |
||
| 34 | |||
| 35 | 15 | foreach ($rClass->getProperties() as $property) { |
|
| 36 | 15 | $propertyName = SerializerUtil::getSerializedNameAttribute($property)->getSerializedName(); |
|
| 37 | 15 | $constraints[$propertyName] = ClassUtil::isNotBuiltinAndExists($propertyClass = $property->getType()?->getName()) |
|
|
|
|||
| 38 | 1 | ? ConstraintsUtil::createCollection($this->extractConstraints(new \ReflectionClass($propertyClass))) |
|
| 39 | 15 | : ConstraintsUtil::fromProperty($property); |
|
| 40 | } |
||
| 41 | |||
| 42 | 15 | return $constraints; |
|
| 43 | } |
||
| 45 |