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