@@ -2,20 +2,20 @@ 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 | } |
| 21 | 21 | } |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $this->isSettable($field); |
| 34 | 34 | |
| 35 | - if($this->full){ |
|
| 36 | - switch($this->data[$field]['type']){ |
|
| 35 | + if ($this->full) { |
|
| 36 | + switch ($this->data[$field]['type']) { |
|
| 37 | 37 | case 'date': |
| 38 | - return (!empty($this->data[$field]['value'])) ? (@date_format( @date_create_from_format('Y-m-d' , $this->data[$field]['value'] ) , DATAMANAGER_CONFIG['dateformat'])) : null ; |
|
| 38 | + return (!empty($this->data[$field]['value'])) ? (@date_format(@date_create_from_format('Y-m-d', $this->data[$field]['value']), DATAMANAGER_CONFIG['dateformat'])) : null; |
|
| 39 | 39 | break; |
| 40 | 40 | case 'datetime': |
| 41 | - 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 ; |
|
| 41 | + 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; |
|
| 42 | 42 | break; |
| 43 | 43 | } |
| 44 | 44 | } |