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