| Conditions | 4 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 90 | public function resolveProperty(object $object, string $property) |
|
| 18 | { |
||
| 19 | 90 | $accessor = $this->resolvePropertyAccessor($property); |
|
| 20 | |||
| 21 | 90 | if ($accessor && method_exists($object, $accessor)) { |
|
| 22 | 9 | return $object->{$accessor}(); |
|
| 23 | } |
||
| 24 | |||
| 25 | 90 | if (property_exists($object, $property)) { |
|
| 26 | 90 | return $object->$property; |
|
| 27 | } |
||
| 28 | |||
| 29 | 3 | throw new LogicException( |
|
| 30 | 3 | sprintf( |
|
| 31 | 'No method of access for "%s" in %s has been defined.', |
||
| 32 | $property, |
||
| 33 | 3 | get_class($object) |
|
| 34 | ) |
||
| 43 |