| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public static function getProperty(&$entryObject, $property) |
||
| 14 | { |
||
| 15 | // If magic method exists, try that first, else try property directly |
||
| 16 | if (method_exists($entryObject, '__get')) { |
||
| 17 | $value = $entryObject->$property; |
||
| 18 | } else { |
||
| 19 | $reflectionProperty = new \ReflectionProperty(get_class($entryObject), $property); |
||
| 20 | $reflectionProperty->setAccessible(true); |
||
| 21 | $value = $reflectionProperty->getValue($entryObject); |
||
| 22 | } |
||
| 23 | return $value; |
||
| 24 | } |
||
| 25 | |||
| 44 | } |