Conditions | 5 |
Paths | 5 |
Total Lines | 32 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | public function __call($name = '', $args = []) |
||
14 | { |
||
15 | $action = strtolower(substr($name,0, 3)); |
||
16 | $trace = debug_backtrace(); |
||
17 | |||
18 | switch($action) { |
||
19 | case 'get': |
||
20 | $name = substr($name, 3); |
||
21 | $param = lcfirst($name); |
||
22 | |||
23 | if (property_exists($this, $param) === true){ |
||
24 | return $this->$param; |
||
25 | } else { |
||
26 | $this->trigger_error($name, $trace); |
||
27 | } |
||
28 | break; |
||
29 | |||
30 | case 'set': |
||
31 | $name = substr($name, 3); |
||
32 | $param = lcfirst($name); |
||
33 | |||
34 | if (property_exists($this, $param) === true){ |
||
35 | $this->$param = $args[0]; |
||
36 | } else { |
||
37 | $this->trigger_error($name, $trace); |
||
38 | } |
||
39 | break; |
||
40 | default: |
||
41 | $this->trigger_error($name, $trace); |
||
42 | break; |
||
43 | } |
||
44 | } |
||
45 | |||
58 | } |