Conditions | 4 |
Paths | 4 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
47 | public function getValue($object) |
||
48 | { |
||
49 | $get = 'get'.ucfirst($this->property); |
||
50 | $has = 'has'.ucfirst($this->property); |
||
51 | $is = 'is'.ucfirst($this->property); |
||
52 | |||
53 | if (method_exists($object, $get)) { |
||
54 | return $object->$get(); |
||
55 | } |
||
56 | |||
57 | if (method_exists($object, $has)) { |
||
58 | return $object->$has(); |
||
59 | } |
||
60 | |||
61 | if (method_exists($object, $is)) { |
||
62 | return $object->$is(); |
||
63 | } |
||
64 | |||
65 | throw new \RuntimeException( |
||
66 | sprintf('Missing method to get property %s on class %ss', $this->property, get_class($object)) |
||
67 | ); |
||
68 | } |
||
69 | } |
||
70 |