| Conditions | 4 |
| Paths | 6 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 2 | public function execute(object $object, string $property, array $methodPrefixes = ['get', 'is']) |
|
| 24 | { |
||
| 25 | try { |
||
| 26 | 2 | foreach ($methodPrefixes as $getterMethodPrefix) { |
|
| 27 | 2 | $getterMethod = $this->createPropertyMethodName($getterMethodPrefix, $property); |
|
| 28 | |||
| 29 | 2 | if (\method_exists($object, $getterMethod)) { |
|
| 30 | 2 | return $object->$getterMethod(); |
|
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | 2 | return $object->$property; |
|
| 35 | 1 | } catch (\Throwable $t) { |
|
| 36 | 1 | throw new PropertyNotAccessibleException($t->getMessage()); |
|
| 37 | } |
||
| 40 |