Test Failed
Push — master ( a37a78...a0e54a )
by Supun
05:06
created
src/Client.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
         //create tables
119 119
         foreach ($JsonExtractor->getTablesArray() as $TableName => $TableColumn) {
120 120
             $this->capsule::schema()->dropIfExists($TableName);
121
-            $this->capsule::schema()->create($TableName, function ($table) use ($TableColumn) {
121
+            $this->capsule::schema()->create($TableName, function($table) use ($TableColumn) {
122 122
                 foreach ($TableColumn as $column_item) {
123 123
                     switch ($column_item['type']) {
124 124
                         case 'int':
Please login to merge, or discard this patch.
src/Helpers/Json.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function validate($json)
64 64
     {
65 65
         if (is_array($json)) {
66
-            return (object)[
66
+            return (object) [
67 67
                 $this->main_table_name => $json
68 68
             ];
69 69
         }
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
             $array = json_decode($array, true);
84 84
         }//if this is not the first time decode the text
85 85
 
86
-        $return_array = $array;//return array
86
+        $return_array = $array; //return array
87 87
 
88 88
         foreach ($array ?? [] as $key => $array_item) {
89 89
             if (!is_numeric($key) && $parent_table) {//single array table, no column
90
-                $table_name = $parent_table . '_' . $key;
90
+                $table_name = $parent_table.'_'.$key;
91 91
             } elseif ($parent_table) {//multiple array items
92 92
                 $table_name = $parent_table;
93 93
             } else {//first time loop
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
             }
96 96
 
97 97
             if (is_array($array_item)) {//if this is a array
98
-                $array_item = $this->addID($array_item, $table_name, $this->increment);//recursive the array
98
+                $array_item = $this->addID($array_item, $table_name, $this->increment); //recursive the array
99 99
                 if (empty($array_item['id']) && empty($array_item[0])) {//if this is a single array with no child
100
-                    $array_item = ['id' => $this->increment++] + $array_item;//add id
100
+                    $array_item = ['id' => $this->increment++] + $array_item; //add id
101 101
                 }
102 102
 
103 103
                 if (isset($array_item[0]) && !is_array($array_item[0]) && !is_object($array_item[0])) {//reference table
104 104
 
105 105
 
106
-                    $array_item = (object)array_map(function ($item) {
107
-                        return (object)[
106
+                    $array_item = (object) array_map(function($item) {
107
+                        return (object) [
108 108
                             'id' => $this->increment++,
109 109
                             'value'=>$item
110 110
                         ];
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $return_array = $array;
134 134
         foreach ($array ?? [] as $key => $array_item) {
135 135
             if (!is_numeric($key) && $parent_table) {//single array table, no column
136
-                $table_name = $parent_table . '_' . $key;
136
+                $table_name = $parent_table.'_'.$key;
137 137
             } elseif ($parent_table) {//multiple array items
138 138
                 $table_name = $parent_table;
139 139
             } elseif (!is_numeric($key)) {  //first time loop
Please login to merge, or discard this patch.
src/Extractor/JsonExtractor.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
 
74 74
             if (is_array($value) && is_object($value[0])) {//check whether it's a array and it's firs element is a object
75 75
 
76
-                $table_data = $this->getTable($prefix . $table_name, $value); //get table sql
76
+                $table_data = $this->getTable($prefix.$table_name, $value); //get table sql
77 77
                 $this->table[$table_data['name']] = $table_data['column'];
78 78
 
79
-                $this->toMysqlTables($this->getHighestColumnArray($value), $prefix . $table_name . "_"); //get it inside tables
79
+                $this->toMysqlTables($this->getHighestColumnArray($value), $prefix.$table_name."_"); //get it inside tables
80 80
             } elseif (is_array($value) || is_object($value)) {//if it's a array and  firs element is not a object
81 81
 
82
-                $table_data = $this->getTable($prefix . $table_name, $value);
82
+                $table_data = $this->getTable($prefix.$table_name, $value);
83 83
                 $this->table[$table_data['name']] = $table_data['column'];
84 84
             }
85 85
         }
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
         }
98 98
         foreach ($data as $table_name => $value) {
99 99
             if ($this->snake_case_table) {
100
-                $table_name = $this->snakeCase($prefix . $table_name);
100
+                $table_name = $this->snakeCase($prefix.$table_name);
101 101
             }
102 102
             if (is_array($value) && !empty($value) && is_object($value[0])) {//if it's a array and  firs element is not a object
103
-                $this->toMysqlData($value, $table_name . '_');
103
+                $this->toMysqlData($value, $table_name.'_');
104 104
             } elseif (is_object($value) || is_array($value)) {
105
-                $this->toMysqlData($value, $table_name . '_');
105
+                $this->toMysqlData($value, $table_name.'_');
106 106
                 $this->getTableData($table_name, $value);
107 107
             }
108 108
         }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         if ($this->snake_case_column) {
159 159
             return [
160 160
                 'name' => $table,
161
-                'column' => array_map(function ($item) {
161
+                'column' => array_map(function($item) {
162 162
                     return [
163 163
                         'name' => $this->snakeCase($item['name']),
164 164
                         'type' => $item['type'],
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
                 } elseif (is_numeric($item)) {
337 337
                     $value[] = $item;
338 338
                 } else {
339
-                    $value[] = '"' . addcslashes($item, "W") . '"';
339
+                    $value[] = '"'.addcslashes($item, "W").'"';
340 340
                 }
341 341
             }
342
-            $String[] = '(' . implode(",", $value) . ')';
342
+            $String[] = '('.implode(",", $value).')';
343 343
         }
344 344
 
345
-        return "values" . implode(", ", $String);
345
+        return "values".implode(", ", $String);
346 346
     }
347 347
 
348 348
     /**
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
     {
354 354
         $String = [];
355 355
         foreach ($array as $column) {
356
-            $String[] = "`" . JsonExtractor::snakeCase($column['name']) . "`";
356
+            $String[] = "`".JsonExtractor::snakeCase($column['name'])."`";
357 357
         }
358 358
 
359 359
         return implode(",", $String);
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
         } elseif (empty($Data)) {
374 374
             return $empty_val;
375 375
         } else {
376
-            return (string)$Data;
376
+            return (string) $Data;
377 377
         }
378 378
     }
379 379
 }
Please login to merge, or discard this patch.