@@ -23,10 +23,10 @@ |
||
23 | 23 | |
24 | 24 | print "update user"; |
25 | 25 | |
26 | -$name = ["Robson", "Kaue", "Gustavo", "João"]; |
|
26 | +$name = [ "Robson", "Kaue", "Gustavo", "João" ]; |
|
27 | 27 | |
28 | 28 | $user = (new User())->findById(100); |
29 | -$user->first_name = $name[rand(0, 3)]; |
|
29 | +$user->first_name = $name[ rand(0, 3) ]; |
|
30 | 30 | $user->save(); |
31 | 31 | |
32 | 32 | var_dump($user); |
@@ -251,9 +251,9 @@ discard block |
||
251 | 251 | */ |
252 | 252 | protected function required(): bool |
253 | 253 | { |
254 | - $data = (array)$this->data(); |
|
254 | + $data = (array) $this->data(); |
|
255 | 255 | foreach ($this->required as $field) { |
256 | - if (empty($data[$field])) { |
|
256 | + if (empty($data[ $field ])) { |
|
257 | 257 | return false; |
258 | 258 | } |
259 | 259 | } |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | */ |
266 | 266 | protected function safe(): ?array |
267 | 267 | { |
268 | - $safe = (array)$this->data; |
|
269 | - foreach ([$this->primary, "updated_at", "created_at"] as $unset) { |
|
270 | - unset($safe[$unset]); |
|
268 | + $safe = (array) $this->data; |
|
269 | + foreach ([ $this->primary, "updated_at", "created_at" ] as $unset) { |
|
270 | + unset($safe[ $unset ]); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | return $safe; |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | protected function update(array $data, string $terms, string $params): ?int |
38 | 38 | { |
39 | 39 | try { |
40 | - $dateSet = []; |
|
40 | + $dateSet = [ ]; |
|
41 | 41 | foreach ($data as $bind => $value) { |
42 | - $dateSet[] = "{$bind} = :{$bind}"; |
|
42 | + $dateSet[ ] = "{$bind} = :{$bind}"; |
|
43 | 43 | } |
44 | 44 | $dateSet = implode(", ", $dateSet); |
45 | 45 | parse_str($params, $params); |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | */ |
83 | 83 | private function filter(array $data): ?array |
84 | 84 | { |
85 | - $filter = []; |
|
85 | + $filter = [ ]; |
|
86 | 86 | foreach ($data as $key => $value) { |
87 | - $filter[$key] = (is_null($value) ? null : filter_var($value, FILTER_DEFAULT)); |
|
87 | + $filter[ $key ] = (is_null($value) ? null : filter_var($value, FILTER_DEFAULT)); |
|
88 | 88 | } |
89 | 89 | return $filter; |
90 | 90 | } |
@@ -15,6 +15,6 @@ |
||
15 | 15 | */ |
16 | 16 | public function __construct() |
17 | 17 | { |
18 | - parent::__construct("address", [], 'address_id'); |
|
18 | + parent::__construct("address", [ ], 'address_id'); |
|
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -15,6 +15,6 @@ |
||
15 | 15 | */ |
16 | 16 | public function __construct() |
17 | 17 | { |
18 | - parent::__construct("users", ["first_name", "last_name"]); |
|
18 | + parent::__construct("users", [ "first_name", "last_name" ]); |
|
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |