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