Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.7898 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function __get(string $name) |
||
19 | 16 | { |
|
20 | $relation = $this->__cycle_orm_rel_map->getRelations()[$name] ?? null; |
||
21 | 16 | if ($relation === null) { |
|
22 | 16 | throw new \RuntimeException(\sprintf('Undefined property %s.%s.', static::class, $name)); |
|
23 | } |
||
24 | $value = $this->__cycle_orm_rel_data[$name] ?? null; |
||
25 | 16 | if ($value instanceof ReferenceInterface) { |
|
26 | 16 | $this->$name = $relation->collect($relation->resolve($value, true)); |
|
27 | unset($this->__cycle_orm_rel_data[$name]); |
||
28 | return $this->$name; |
||
29 | } |
||
30 | return $value ?? $this->$name; |
||
31 | 16 | } |
|
56 |