@@ -46,7 +46,7 @@ |
||
| 46 | 46 | public function validate($json) |
| 47 | 47 | { |
| 48 | 48 | if (is_array($json)) { |
| 49 | - return (object)[ |
|
| 49 | + return (object) [ |
|
| 50 | 50 | $this->main_table_name=>$json |
| 51 | 51 | ]; |
| 52 | 52 | } |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | if (is_array($value) && is_object($value[0])) {//check whether it's a array and it's firs element is a object |
| 66 | 66 | |
| 67 | - $table_data = $this->getTable($prefix . $table_name, $value);//get table sql |
|
| 67 | + $table_data = $this->getTable($prefix.$table_name, $value); //get table sql |
|
| 68 | 68 | $this->table[$table_data['tables']['name']] = $table_data['tables']['column']; |
| 69 | 69 | $this->data[$table_data['data']['table']] = $table_data['data']['data']; |
| 70 | 70 | |
| 71 | - $this->toMysqlTables($this->getHighestColumnArray($value), $prefix . $table_name . '_');//get it inside tables |
|
| 71 | + $this->toMysqlTables($this->getHighestColumnArray($value), $prefix.$table_name.'_'); //get it inside tables |
|
| 72 | 72 | } elseif (is_array($value) || is_object($value)) {//if it's a array and firs element is not a object |
| 73 | 73 | |
| 74 | - $table_data = $this->getTable($prefix . $table_name, $value); |
|
| 74 | + $table_data = $this->getTable($prefix.$table_name, $value); |
|
| 75 | 75 | $this->table[$table_data['tables']['name']] = $table_data['tables']['column']; |
| 76 | 76 | $this->data[$table_data['data']['table']] = $table_data['data']['data']; |
| 77 | 77 | } |
@@ -235,13 +235,13 @@ discard block |
||
| 235 | 235 | } elseif (is_numeric($item)) { |
| 236 | 236 | $value[] = $item; |
| 237 | 237 | } else { |
| 238 | - $value[] = '"' . addcslashes($item, "W") . '"'; |
|
| 238 | + $value[] = '"'.addcslashes($item, "W").'"'; |
|
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | - $String[] = '(' . implode(",", $value) . ')'; |
|
| 241 | + $String[] = '('.implode(",", $value).')'; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - return "values" . implode(", ", $String); |
|
| 244 | + return "values".implode(", ", $String); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | { |
| 253 | 253 | $String = []; |
| 254 | 254 | foreach ($array as $column) { |
| 255 | - $String[] = "`" . JsonExtractor::snakeCase($column['name']) . "`"; |
|
| 255 | + $String[] = "`".JsonExtractor::snakeCase($column['name'])."`"; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | return implode(",", $String); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | } elseif (empty($Data)) { |
| 272 | 272 | return $empty_val; |
| 273 | 273 | } else { |
| 274 | - return (string)$Data; |
|
| 274 | + return (string) $Data; |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | { |
| 77 | 77 | foreach ($JsonExtractor->getTablesArray() as $TableName => $TableColumn) { |
| 78 | 78 | $this->capsule::schema()->dropIfExists($TableName); |
| 79 | - $this->capsule::schema()->create($TableName, function ($table) use ($TableColumn) { |
|
| 79 | + $this->capsule::schema()->create($TableName, function($table) use ($TableColumn) { |
|
| 80 | 80 | foreach ($TableColumn as $column_item) { |
| 81 | 81 | switch ($column_item['type']) { |
| 82 | 82 | case 'int': |