@@ -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 | } |
@@ -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': |
@@ -63,13 +63,13 @@ discard block |
||
| 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 | |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | foreach ($data as $table_name => $value) { |
| 87 | 87 | if ($this->snake_case_table) { |
| 88 | - $table_name = $this->snakeCase($prefix . $table_name); |
|
| 88 | + $table_name = $this->snakeCase($prefix.$table_name); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if (is_array($value)) {//if it's a array and firs element is not a object |
| 92 | - $this->toMysqlData($value, $table_name . '_'); |
|
| 92 | + $this->toMysqlData($value, $table_name.'_'); |
|
| 93 | 93 | } elseif (is_object($value)) { |
| 94 | - $this->toMysqlData($value, $table_name . '_'); |
|
| 94 | + $this->toMysqlData($value, $table_name.'_'); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | //TODO |
| 102 | - public function getTableData(){ |
|
| 102 | + public function getTableData() { |
|
| 103 | 103 | |
| 104 | 104 | } |
| 105 | 105 | |
@@ -252,13 +252,13 @@ discard block |
||
| 252 | 252 | } elseif (is_numeric($item)) { |
| 253 | 253 | $value[] = $item; |
| 254 | 254 | } else { |
| 255 | - $value[] = '"' . addcslashes($item, "W") . '"'; |
|
| 255 | + $value[] = '"'.addcslashes($item, "W").'"'; |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | - $String[] = '(' . implode(",", $value) . ')'; |
|
| 258 | + $String[] = '('.implode(",", $value).')'; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - return "values" . implode(", ", $String); |
|
| 261 | + return "values".implode(", ", $String); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | { |
| 270 | 270 | $String = []; |
| 271 | 271 | foreach ($array as $column) { |
| 272 | - $String[] = "`" . JsonExtractor::snakeCase($column['name']) . "`"; |
|
| 272 | + $String[] = "`".JsonExtractor::snakeCase($column['name'])."`"; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | return implode(",", $String); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } elseif (empty($Data)) { |
| 290 | 290 | return $empty_val; |
| 291 | 291 | } else { |
| 292 | - return (string)$Data; |
|
| 292 | + return (string) $Data; |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | } |