Passed
Push — master ( 4320c6...89564b )
by Robson
01:36
created
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/Models/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 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
     public function fullName()
Please login to merge, or discard this patch.
example/find_example.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 }
49 49
 
50 50
 print "secure params";
51
-$params = http_build_query(["name" => "UpInside & Associated"]);
51
+$params = http_build_query([ "name" => "UpInside & Associated" ]);
52 52
 $company = (new Company())->find("name = :name", $params);
53 53
 var_dump($company, $company->fetch());
54 54
 
Please login to merge, or discard this patch.
example/Models/Address.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      */
16 16
     public function __construct()
17 17
     {
18
-        parent::__construct("adresses", ["user_id"]);
18
+        parent::__construct("adresses", [ "user_id" ]);
19 19
     }
20 20
 
21 21
     public function user(): Address
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
@@ -38,11 +38,11 @@
 block discarded – undo
38 38
 if ($update) {
39 39
     echo "<h1>Update:</h1>";
40 40
 
41
-    $name = ["Marcos", "Marcelo", "Ricardo", "João"];
41
+    $name = [ "Marcos", "Marcelo", "Ricardo", "João" ];
42 42
     $user = (new User())->findById(4);
43 43
 
44 44
     if ($user) {
45
-        $user->first_name = $name[rand(0, 3)];
45
+        $user->first_name = $name[ rand(0, 3) ];
46 46
         if ($user->save()) {
47 47
             echo "Usuário atualizado";
48 48
             var_dump($user->data());
Please login to merge, or discard this patch.
src/DataLayer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
      */
296 296
     protected function required(): bool
297 297
     {
298
-        $data = (array)$this->data();
298
+        $data = (array) $this->data();
299 299
         foreach ($this->required as $field) {
300
-            if (empty($data[$field])) {
301
-                if (!is_int($data[$field])) {
300
+            if (empty($data[ $field ])) {
301
+                if (!is_int($data[ $field ])) {
302 302
                     return false;
303 303
                 }
304 304
             }
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
      */
312 312
     protected function safe(): ?array
313 313
     {
314
-        $safe = (array)$this->data;
315
-        unset($safe[$this->primary]);
314
+        $safe = (array) $this->data;
315
+        unset($safe[ $this->primary ]);
316 316
         return $safe;
317 317
     }
318 318
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     protected function toCamelCase(string $string): string
325 325
     {
326 326
         $camelCase = str_replace(' ', '', ucwords(str_replace('_', ' ', $string)));
327
-        $camelCase[0] = strtolower($camelCase[0]);
327
+        $camelCase[ 0 ] = strtolower($camelCase[ 0 ]);
328 328
         return $camelCase;
329 329
     }
330 330
 }
Please login to merge, or discard this patch.