@@ -2,23 +2,23 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace HnrAzevedo\Datamanager; |
4 | 4 | |
5 | -trait MagicsTrait{ |
|
5 | +trait MagicsTrait { |
|
6 | 6 | |
7 | - public function __set(string $prop,$value) |
|
7 | + public function __set(string $prop, $value) |
|
8 | 8 | { |
9 | - if(is_array($value)){ |
|
9 | + if (is_array($value)) { |
|
10 | 10 | $attr = array_keys($value)[0]; |
11 | 11 | $this->data[$prop][$attr] = $value[$attr]; |
12 | 12 | return $this; |
13 | 13 | } |
14 | 14 | |
15 | - if($this->full){ |
|
16 | - switch($this->data[$prop]['type']){ |
|
15 | + if ($this->full) { |
|
16 | + switch ($this->data[$prop]['type']) { |
|
17 | 17 | case 'date': |
18 | - $value = (date_format( date_create_from_format(DATAMANAGER_CONFIG['dateformat'],$value) , 'Y-m-d')); |
|
18 | + $value = (date_format(date_create_from_format(DATAMANAGER_CONFIG['dateformat'], $value), 'Y-m-d')); |
|
19 | 19 | break; |
20 | 20 | case 'datetime': |
21 | - $value = (date_format( date_create_from_format(DATAMANAGER_CONFIG['datetimeformat'],$value) , 'Y-m-d H:i:s')); |
|
21 | + $value = (date_format(date_create_from_format(DATAMANAGER_CONFIG['datetimeformat'], $value), 'Y-m-d H:i:s')); |
|
22 | 22 | break; |
23 | 23 | } |
24 | 24 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | return $this; |
34 | 34 | } |
35 | 35 | |
36 | - public function get(string $field){ |
|
36 | + public function get(string $field) { |
|
37 | 37 | return $this->data[$field]['value']; |
38 | 38 | } |
39 | 39 | |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | { |
42 | 42 | $this->isSettable($field); |
43 | 43 | |
44 | - if($this->full){ |
|
45 | - switch($this->data[$field]['type']){ |
|
44 | + if ($this->full) { |
|
45 | + switch ($this->data[$field]['type']) { |
|
46 | 46 | case 'date': |
47 | - return (!empty($this->data[$field]['value'])) ? (@date_format( @date_create_from_format('Y-m-d' , $this->data[$field]['value'] ) , DATAMANAGER_CONFIG['dateformat'])) : null ; |
|
47 | + return (!empty($this->data[$field]['value'])) ? (@date_format(@date_create_from_format('Y-m-d', $this->data[$field]['value']), DATAMANAGER_CONFIG['dateformat'])) : null; |
|
48 | 48 | break; |
49 | 49 | case 'datetime': |
50 | - return (!empty($this->data[$field]['value'])) ? (@date_format( @date_create_from_format('Y-m-d H:i:s' , $this->data[$field]['value'] ) , DATAMANAGER_CONFIG['datetimeformat'])) : null ; |
|
50 | + return (!empty($this->data[$field]['value'])) ? (@date_format(@date_create_from_format('Y-m-d H:i:s', $this->data[$field]['value']), DATAMANAGER_CONFIG['datetimeformat'])) : null; |
|
51 | 51 | break; |
52 | 52 | } |
53 | 53 | } |