@@ -63,7 +63,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |