Completed
Push — master ( fcb1ca...cd9585 )
by Supun
02:16
created
src/Extractor/JsonExtractor.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 
64 64
             if (is_array($value) && is_object($value[0])) {//check whether it's a array and it's firs element is a object
65 65
 
66
-                $table_data = $this->getTable($prefix . $table_name, $value);//get table sql
66
+                $table_data = $this->getTable($prefix.$table_name, $value); //get table sql
67 67
                 $this->table[$table_data['name']] = $table_data['column'];
68 68
 
69
-                $this->toMysqlTables($this->getHighestColumnArray($value), $prefix . $table_name . '_');//get it inside tables
69
+                $this->toMysqlTables($this->getHighestColumnArray($value), $prefix.$table_name.'_'); //get it inside tables
70 70
             } elseif (is_array($value) || is_object($value)) {//if it's a array and  firs element is not a object
71 71
 
72
-                $table_data = $this->getTable($prefix . $table_name, $value);
72
+                $table_data = $this->getTable($prefix.$table_name, $value);
73 73
                 $this->table[$table_data['name']] = $table_data['column'];
74 74
             }
75 75
 
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
         }
91 91
         foreach ($data as $table_name => $value) {
92 92
             if ($this->snake_case_table) {
93
-                $table_name = $this->snakeCase($prefix . $table_name);
93
+                $table_name = $this->snakeCase($prefix.$table_name);
94 94
             }
95 95
             if (is_array($value) && is_object($value[0])) {//if it's a array and  firs element is not a object
96
-                $this->toMysqlData($value, $table_name . '_');
96
+                $this->toMysqlData($value, $table_name.'_');
97 97
 
98 98
             } elseif (is_object($value) || is_array($value)) {
99
-                $this->toMysqlData($value, $table_name . '_');
99
+                $this->toMysqlData($value, $table_name.'_');
100 100
                 $this->getTableData($table_name, $value);
101 101
 
102 102
             }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                 foreach ($value as $item_value)
136 136
                     $DataItem[] = ['value' => $item_value];
137 137
 
138
-                $this->data[$table_name] =  array_merge(($this->data[$table_name]??[]),$DataItem);
138
+                $this->data[$table_name] = array_merge(($this->data[$table_name]??[]), $DataItem);
139 139
 
140 140
             }
141 141
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         if ($this->snake_case_column)
171 171
             return [
172 172
                 'name' => $table,
173
-                'column' => array_map(function ($item) {
173
+                'column' => array_map(function($item) {
174 174
                     return [
175 175
                         'name' => $this->snakeCase($item['name']),
176 176
                         'type' => $item['type']
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
                 } elseif (is_numeric($item)) {
341 341
                     $value[] = $item;
342 342
                 } else {
343
-                    $value[] = '"' . addcslashes($item, "W") . '"';
343
+                    $value[] = '"'.addcslashes($item, "W").'"';
344 344
                 }
345 345
             }
346
-            $String[] = '(' . implode(",", $value) . ')';
346
+            $String[] = '('.implode(",", $value).')';
347 347
         }
348 348
 
349
-        return "values" . implode(", ", $String);
349
+        return "values".implode(", ", $String);
350 350
     }
351 351
 
352 352
     /**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     {
358 358
         $String = [];
359 359
         foreach ($array as $column) {
360
-            $String[] = "`" . JsonExtractor::snakeCase($column['name']) . "`";
360
+            $String[] = "`".JsonExtractor::snakeCase($column['name'])."`";
361 361
         }
362 362
 
363 363
         return implode(",", $String);
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         } elseif (empty($Data)) {
378 378
             return $empty_val;
379 379
         } else {
380
-            return (string)$Data;
380
+            return (string) $Data;
381 381
         }
382 382
     }
383 383
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -132,8 +132,9 @@  discard block
 block discarded – undo
132 132
                 $this->data[$table_name][] = $DataItem;
133 133
 
134 134
             } elseif (is_array($value)) {//reference table
135
-                foreach ($value as $item_value)
136
-                    $DataItem[] = ['value' => $item_value];
135
+                foreach ($value as $item_value) {
136
+                                    $DataItem[] = ['value' => $item_value];
137
+                }
137 138
 
138 139
                 $this->data[$table_name] =  array_merge(($this->data[$table_name]??[]),$DataItem);
139 140
 
@@ -167,23 +168,25 @@  discard block
 block discarded – undo
167 168
             ];
168 169
         }
169 170
 
170
-        if ($this->snake_case_column)
171
-            return [
171
+        if ($this->snake_case_column) {
172
+                    return [
172 173
                 'name' => $table,
173 174
                 'column' => array_map(function ($item) {
174 175
                     return [
175 176
                         'name' => $this->snakeCase($item['name']),
176 177
                         'type' => $item['type']
177 178
                     ];
179
+        }
178 180
 
179 181
                 }, $last_columns)
180 182
             ];
181 183
 
182
-        else
183
-            return [
184
+        else {
185
+                    return [
184 186
                 'name' => $table,
185 187
                 'column' => $last_columns
186 188
             ];
189
+        }
187 190
     }
188 191
 
189 192
     /**
Please login to merge, or discard this patch.