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