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