| @@ 58-67 (lines=10) @@ | ||
| 55 | * @param mixed $value the new value |
|
| 56 | * @return void |
|
| 57 | */ |
|
| 58 | public function __set($name, $value) |
|
| 59 | { |
|
| 60 | $c = static::camelize($name); |
|
| 61 | $m = "set$c"; |
|
| 62 | if (method_exists($this, $m)) { |
|
| 63 | $this->$m($value); |
|
| 64 | } else { |
|
| 65 | user_error("undefined property $name"); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * Magic getter function |
|
| @@ 74-83 (lines=10) @@ | ||
| 71 | * @param string $name of the attribute to get |
|
| 72 | * @return mixed the attribute's value |
|
| 73 | */ |
|
| 74 | public function __get($name) |
|
| 75 | { |
|
| 76 | $c = static::camelize($name); |
|
| 77 | $m = "get$c"; |
|
| 78 | if (method_exists($this, $m)) { |
|
| 79 | return $this->$m(); |
|
| 80 | } else { |
|
| 81 | user_error("undefined property $name"); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * Request constructor. |
|