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