| @@ 71-79 (lines=9) @@ | ||
| 68 | * |
|
| 69 | * @return mixed |
|
| 70 | */ |
|
| 71 | public function __get(string $property) |
|
| 72 | { |
|
| 73 | $expectedMethod = 'Get' . ucfirst($property); |
|
| 74 | if (true !== method_exists($this, $expectedMethod)) { |
|
| 75 | throw new UndefinedPropertyException(static::class, $property); |
|
| 76 | } |
|
| 77 | ||
| 78 | return $this->$expectedMethod(); |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * Maps param $property to the getter method. |
|
| @@ 91-101 (lines=11) @@ | ||
| 88 | * |
|
| 89 | * @return mixed |
|
| 90 | */ |
|
| 91 | public function __set(string $property, $v) |
|
| 92 | { |
|
| 93 | $expectedMethod = 'Set' . ucfirst($property); |
|
| 94 | if ( |
|
| 95 | true !== method_exists($this, $expectedMethod) |
|
| 96 | ) { |
|
| 97 | throw new PropertyNotWriteableException(static::class, $property); |
|
| 98 | } |
|
| 99 | ||
| 100 | return $this->$expectedMethod($v); |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * required to support unset($foo->bar). |
|