| @@ 29-46 (lines=18) @@ | ||
| 26 | * @param object $object |
|
| 27 | * @param mixed $value |
|
| 28 | */ |
|
| 29 | public function setValue($object, $value) |
|
| 30 | { |
|
| 31 | $class = $this->getClass($object); |
|
| 32 | ||
| 33 | if (!property_exists($class, $this->property)) { |
|
| 34 | throw DeserializerLogicException::createMissingProperty($class, $this->property); |
|
| 35 | } |
|
| 36 | ||
| 37 | $setter = \Closure::bind( |
|
| 38 | function ($property, $value) { |
|
| 39 | $this->$property = $value; |
|
| 40 | }, |
|
| 41 | $object, |
|
| 42 | $class |
|
| 43 | ); |
|
| 44 | ||
| 45 | return $setter($this->property, $value); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @param object $object |
|
| @@ 53-70 (lines=18) @@ | ||
| 50 | * |
|
| 51 | * @return mixed |
|
| 52 | */ |
|
| 53 | public function getValue($object) |
|
| 54 | { |
|
| 55 | $class = $this->getClass($object); |
|
| 56 | ||
| 57 | if (!property_exists($class, $this->property)) { |
|
| 58 | throw DeserializerLogicException::createMissingProperty($class, $this->property); |
|
| 59 | } |
|
| 60 | ||
| 61 | $getter = \Closure::bind( |
|
| 62 | function ($property) { |
|
| 63 | return $this->$property; |
|
| 64 | }, |
|
| 65 | $object, |
|
| 66 | $class |
|
| 67 | ); |
|
| 68 | ||
| 69 | return $getter($this->property); |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * @param object $object |
|