| @@ 64-71 (lines=8) @@ | ||
| 61 | * @param string $key |
|
| 62 | * @param mixed $value |
|
| 63 | */ |
|
| 64 | public function __set ($key, $value) { |
|
| 65 | $setter = 'set' . ucfirst($key); |
|
| 66 | if (method_exists($this, $setter)) { |
|
| 67 | call_user_func([$this, $setter], $value); |
|
| 68 | return; |
|
| 69 | } |
|
| 70 | $this->{$key} = $value; |
|
| 71 | } |
|
| 72 | ||
| 73 | /** |
|
| 74 | * @param string $key |
|
| @@ 77-83 (lines=7) @@ | ||
| 74 | * @param string $key |
|
| 75 | * @return mixed |
|
| 76 | */ |
|
| 77 | public function __get ($key) { |
|
| 78 | $getter = 'get' . ucfirst($key); |
|
| 79 | if (method_exists($this, $getter)) { |
|
| 80 | return call_user_func([$this, $getter]); |
|
| 81 | } |
|
| 82 | return $this->{$key}; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||