Total Complexity | 5 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait HasAttributes |
||
8 | { |
||
9 | |||
10 | protected $attributes; |
||
11 | |||
12 | public function __set($name, $value) |
||
13 | { |
||
14 | $this->attributes[$name] = $value; |
||
15 | |||
16 | return $this; |
||
17 | } |
||
18 | |||
19 | public function __get($name) |
||
20 | { |
||
21 | if (!array_key_exists($name, $this->attributes)) { |
||
22 | return null; |
||
23 | } |
||
24 | |||
25 | return $this->attributes[$name]; |
||
26 | } |
||
27 | |||
28 | public function __isset($name) |
||
29 | { |
||
30 | return isset($this->attributes[$name]); |
||
31 | } |
||
32 | |||
33 | public function __unset($name) |
||
36 | } |
||
37 | |||
38 | } |
||
39 |