Total Complexity | 7 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait MagicsTrait{ |
||
6 | |||
7 | public function __set(string $prop,$value) |
||
8 | { |
||
9 | if(is_array($value)){ |
||
10 | $attr = array_keys($value)[0]; |
||
11 | $this->data[$prop][$attr] = $value[$attr]; |
||
|
|||
12 | return $this; |
||
13 | } |
||
14 | |||
15 | if($this->full){ |
||
16 | switch($this->data[$prop]['type']){ |
||
17 | case 'date': |
||
18 | $value = (date_format( date_create_from_format(DATAMANAGER_CONFIG['dateformat'],$value) , 'Y-m-d')); |
||
19 | break; |
||
20 | } |
||
21 | } |
||
22 | |||
23 | $this->isSettable($prop); |
||
24 | |||
25 | $this->data[$prop]['changed'] = true; |
||
26 | $this->data[$prop]['value'] = $value; |
||
27 | |||
28 | return $this; |
||
29 | } |
||
30 | |||
31 | public function __get(string $field) |
||
42 | } |
||
43 | } |