| @@ 26-38 (lines=13) @@ | ||
| 23 | * @param object $object |
|
| 24 | * @param mixed $value |
|
| 25 | */ |
|
| 26 | public function setValue($object, $value) |
|
| 27 | { |
|
| 28 | $class = get_class($object); |
|
| 29 | ||
| 30 | try { |
|
| 31 | $reflectionProperty = new \ReflectionProperty($class, $this->property); |
|
| 32 | } catch (\ReflectionException $e) { |
|
| 33 | throw AccessorException::createMissingProperty($class, $this->property); |
|
| 34 | } |
|
| 35 | ||
| 36 | $reflectionProperty->setAccessible(true); |
|
| 37 | $reflectionProperty->setValue($object, $value); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @param object $object |
|
| @@ 45-58 (lines=14) @@ | ||
| 42 | * |
|
| 43 | * @return mixed |
|
| 44 | */ |
|
| 45 | public function getValue($object) |
|
| 46 | { |
|
| 47 | $class = get_class($object); |
|
| 48 | ||
| 49 | try { |
|
| 50 | $reflectionProperty = new \ReflectionProperty($class, $this->property); |
|
| 51 | } catch (\ReflectionException $e) { |
|
| 52 | throw AccessorException::createMissingProperty($class, $this->property); |
|
| 53 | } |
|
| 54 | ||
| 55 | $reflectionProperty->setAccessible(true); |
|
| 56 | ||
| 57 | return $reflectionProperty->getValue($object); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||