Total Complexity | 8 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
18 | trait TProperty { |
||
19 | |||
20 | public function __get($name) { |
||
21 | if (method_exists($this, ($method = 'get'.ucfirst($name)))) |
||
22 | return $this->$method(); |
||
23 | else |
||
24 | throw new \BadMethodCallException("Method $method is not implemented for property $name."); |
||
25 | } |
||
26 | |||
27 | public function __isset($name) { |
||
28 | if (method_exists($this, ($method = 'isset'.ucfirst($name)))) |
||
29 | return $this->$method(); |
||
30 | else |
||
31 | throw new \BadMethodCallException("Method $method is not implemented for property $name."); |
||
32 | } |
||
33 | |||
34 | public function __set($name, $value) { |
||
39 | } |
||
40 | |||
41 | public function __unset($name) { |
||
46 | } |
||
47 | |||
48 | } |