Passed
Pull Request — master (#16)
by Rodinei
02:04
created
example/Models/Address.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
example/Models/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Connect.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@
 block discarded – undo
25 25
         if (empty(self::$instance)) {
26 26
             try {
27 27
                 self::$instance = new PDO(
28
-                    DATA_LAYER_CONFIG["driver"] . ":host=" . DATA_LAYER_CONFIG["host"] . ";dbname=" . DATA_LAYER_CONFIG["dbname"] . ";port=" . DATA_LAYER_CONFIG["port"],
29
-                    DATA_LAYER_CONFIG["username"],
30
-                    DATA_LAYER_CONFIG["passwd"],
31
-                    DATA_LAYER_CONFIG["options"]
28
+                    DATA_LAYER_CONFIG[ "driver" ] . ":host=" . DATA_LAYER_CONFIG[ "host" ] . ";dbname=" . DATA_LAYER_CONFIG[ "dbname" ] . ";port=" . DATA_LAYER_CONFIG[ "port" ],
29
+                    DATA_LAYER_CONFIG[ "username" ],
30
+                    DATA_LAYER_CONFIG[ "passwd" ],
31
+                    DATA_LAYER_CONFIG[ "options" ]
32 32
                 );
33 33
             } catch (PDOException $exception) {
34 34
                 self::$error = $exception;
Please login to merge, or discard this patch.
src/CrudTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
     protected function create(array $data): ?int
21 21
     {
22 22
         if ($this->timestamps) {
23
-            $data["created_at"] = (new DateTime("now"))->format("Y-m-d H:i:s");
24
-            $data["updated_at"] = $data["created_at"];
23
+            $data[ "created_at" ] = (new DateTime("now"))->format("Y-m-d H:i:s");
24
+            $data[ "updated_at" ] = $data[ "created_at" ];
25 25
         }
26 26
 
27 27
         try {
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
     protected function update(array $data, string $terms, string $params): ?int
49 49
     {
50 50
         if ($this->timestamps) {
51
-            $data["updated_at"] = (new DateTime("now"))->format("Y-m-d H:i:s");
51
+            $data[ "updated_at" ] = (new DateTime("now"))->format("Y-m-d H:i:s");
52 52
         }
53 53
 
54 54
         try {
55
-            $dateSet = [];
55
+            $dateSet = [ ];
56 56
             foreach ($data as $bind => $value) {
57
-                $dateSet[] = "{$bind} = :{$bind}";
57
+                $dateSet[ ] = "{$bind} = :{$bind}";
58 58
             }
59 59
             $dateSet = implode(", ", $dateSet);
60 60
             parse_str($params, $params);
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
      */
98 98
     private function filter(array $data): ?array
99 99
     {
100
-        $filter = [];
100
+        $filter = [ ];
101 101
         foreach ($data as $key => $value) {
102
-            $filter[$key] = (is_null($value) ? null : filter_var($value, FILTER_DEFAULT));
102
+            $filter[ $key ] = (is_null($value) ? null : filter_var($value, FILTER_DEFAULT));
103 103
         }
104 104
         return $filter;
105 105
     }
Please login to merge, or discard this patch.
example/save_example.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@
 block discarded – undo
27 27
  */
28 28
 print "<h1>update user</h1>";
29 29
 
30
-$name = ["Robson", "Kaue", "Gustavo", "João"];
30
+$name = [ "Robson", "Kaue", "Gustavo", "João" ];
31 31
 
32 32
 $user = (new User())->findById(56);
33 33
 
34 34
 if ($user) {
35
-    $user->first_name = $name[rand(0, 3)];
35
+    $user->first_name = $name[ rand(0, 3) ];
36 36
     $user->save();
37 37
     dd($user);
38 38
 } else {
Please login to merge, or discard this patch.
example/where_example.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 $model = new User();
50 50
 print "<h1>find with whereIn</h1>";
51 51
 $users = $model
52
-    ->whereIn("id", [53,55])
52
+    ->whereIn("id", [ 53, 55 ])
53 53
     ->find()
54 54
     ->fetch(true);
55 55
 
Please login to merge, or discard this patch.
src/DataLayer.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
      */
215 215
     public function join(string $table, ...$args): DataLayer
216 216
     {
217
-        if (!$args[0] instanceof \Closure && $args[0] && $args[1]) {
218
-            $this->join[] = " INNER JOIN {$table} ON ({$table}.{$args[0]} = {$this->entity}.{$args[1]}) ";
217
+        if (!$args[ 0 ] instanceof \Closure && $args[ 0 ] && $args[ 1 ]) {
218
+            $this->join[ ] = " INNER JOIN {$table} ON ({$table}.{$args[ 0 ]} = {$this->entity}.{$args[ 1 ]}) ";
219 219
         }
220 220
         return $this;
221 221
     }
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function leftJoin(string $table, ...$args): DataLayer
229 229
     {
230
-        if (!$args[0] instanceof \Closure && $args[0] && $args[1]) {
231
-            $this->leftJoin[] = " LEFT OUTER JOIN {$table} ON ({$table}.{$args[0]} = {$this->entity}.{$args[1]}) ";
230
+        if (!$args[ 0 ] instanceof \Closure && $args[ 0 ] && $args[ 1 ]) {
231
+            $this->leftJoin[ ] = " LEFT OUTER JOIN {$table} ON ({$table}.{$args[ 0 ]} = {$this->entity}.{$args[ 1 ]}) ";
232 232
         }
233 233
         return $this;
234 234
     }
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
      */
241 241
     public function rightJoin(string $table, ...$args): DataLayer
242 242
     {
243
-        if (!$args[0] instanceof \Closure && $args[0] && $args[1]) {
244
-            $this->rightJoin[] = " RIGHT OUTER JOIN {$table} ON ({$table}.{$args[0]} = {$this->entity}.{$args[1]}) ";
243
+        if (!$args[ 0 ] instanceof \Closure && $args[ 0 ] && $args[ 1 ]) {
244
+            $this->rightJoin[ ] = " RIGHT OUTER JOIN {$table} ON ({$table}.{$args[ 0 ]} = {$this->entity}.{$args[ 1 ]}) ";
245 245
         }
246 246
         return $this;
247 247
     }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      */
253 253
     public function whereRaw(string $whereRaw): DataLayer
254 254
     {
255
-        $this->where[] = " {$whereRaw} ";
255
+        $this->where[ ] = " {$whereRaw} ";
256 256
         return $this;
257 257
     }
258 258
 
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
      * @param array $values
262 262
      * @return DataLayer
263 263
      */
264
-    public function whereIn(string $field, array $values = []): DataLayer
264
+    public function whereIn(string $field, array $values = [ ]): DataLayer
265 265
     {
266
-        $this->where[] = " {$field} IN (" . implode(",", $values) . ")";
266
+        $this->where[ ] = " {$field} IN (" . implode(",", $values) . ")";
267 267
         return $this;
268 268
     }
269 269
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      */
276 276
     public function where(string $field, string $operator, $value): DataLayer
277 277
     {
278
-        $this->where[] = " {$field} {$operator} :" . str_replace(".", "_", $field);
278
+        $this->where[ ] = " {$field} {$operator} :" . str_replace(".", "_", $field);
279 279
         $params = "{$field}={$value}";
280 280
         $this->concatParams($params);
281 281
         parse_str($params, $this->params);
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
      */
433 433
     protected function required(): bool
434 434
     {
435
-        $data = (array)$this->data();
435
+        $data = (array) $this->data();
436 436
         foreach ($this->required as $field) {
437
-            if (empty($data[$field])) {
437
+            if (empty($data[ $field ])) {
438 438
                 return false;
439 439
             }
440 440
         }
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
      */
447 447
     protected function safe(): ?array
448 448
     {
449
-        $safe = (array)$this->data;
450
-        unset($safe[$this->primary]);
449
+        $safe = (array) $this->data;
450
+        unset($safe[ $this->primary ]);
451 451
 
452 452
         return $safe;
453 453
     }
Please login to merge, or discard this patch.