@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $skip = false; |
95 | 95 | $options = ''; |
96 | 96 | // start table definition |
97 | - $tableName = $this->getTableName ($line); |
|
97 | + $tableName = $this->getTableName($line); |
|
98 | 98 | $tables[$tableName] = []; |
99 | 99 | $tables[$tableName]['options'] = ''; |
100 | 100 | $tables[$tableName]['columns'] = []; |
@@ -140,22 +140,22 @@ discard block |
||
140 | 140 | $schema[] = "{$tkey}:\n"; |
141 | 141 | foreach ($table as $lkey => $line) { |
142 | 142 | if ('keys' == $lkey) { |
143 | - $schema[] = $level1 . "keys:\n"; |
|
143 | + $schema[] = $level1."keys:\n"; |
|
144 | 144 | foreach ($line as $kkey => $kvalue) { |
145 | 145 | foreach ($kvalue as $kkey2 => $kvalue2) { |
146 | - $schema[] = $level2 . $kkey2 . ":\n"; |
|
147 | - $schema[] = $level3 . 'columns: ' . $kvalue2['columns'] . "\n"; |
|
148 | - $schema[] = $level3 . 'unique: ' . $kvalue2['unique'] . "\n"; |
|
146 | + $schema[] = $level2.$kkey2.":\n"; |
|
147 | + $schema[] = $level3.'columns: '.$kvalue2['columns']."\n"; |
|
148 | + $schema[] = $level3.'unique: '.$kvalue2['unique']."\n"; |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | } elseif ('options' == $lkey) { |
152 | - $schema[] = $level1 . 'options: ' . $line . "\n"; |
|
152 | + $schema[] = $level1.'options: '.$line."\n"; |
|
153 | 153 | } else { |
154 | - $schema[] = $level1 . 'columns: ' . "\n"; |
|
154 | + $schema[] = $level1.'columns: '."\n"; |
|
155 | 155 | foreach ($line as $kkey => $kvalue) { |
156 | - $schema[] = $level2 . '-' . "\n"; |
|
156 | + $schema[] = $level2.'-'."\n"; |
|
157 | 157 | foreach ($kvalue as $kkey2 => $kvalue2) { |
158 | - $schema[] = $level3 . $kkey2 . ": " . $kvalue2 . "\n"; |
|
158 | + $schema[] = $level3.$kkey2.": ".$kvalue2."\n"; |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | * @param string $line |
184 | 184 | * @return string|bool |
185 | 185 | */ |
186 | - private function getTableName (string $line) |
|
186 | + private function getTableName(string $line) |
|
187 | 187 | { |
188 | 188 | |
189 | - $arrLine = \explode( '`', $line); |
|
189 | + $arrLine = \explode('`', $line); |
|
190 | 190 | if (\count($arrLine) > 0) { |
191 | 191 | return $arrLine[1]; |
192 | 192 | } |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | * @param string $line |
202 | 202 | * @return array|bool |
203 | 203 | */ |
204 | - private function getColumns (string $line) |
|
204 | + private function getColumns(string $line) |
|
205 | 205 | { |
206 | 206 | |
207 | 207 | $columns = []; |
208 | 208 | |
209 | - $arrCol = \explode( ' ', \trim($line)); |
|
209 | + $arrCol = \explode(' ', \trim($line)); |
|
210 | 210 | if (\count($arrCol) > 0) { |
211 | 211 | $name = \str_replace(['`'], '', $arrCol[0]); |
212 | 212 | } else { |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | $columns['name'] = $name; |
218 | 218 | // update quotes |
219 | 219 | if (\strpos($attributes, "''") > 0) { |
220 | - $attributes = \trim(\str_replace("''", "''''''''" , $attributes)); |
|
220 | + $attributes = \trim(\str_replace("''", "''''''''", $attributes)); |
|
221 | 221 | } elseif (\strpos($attributes, "'") > 0) { |
222 | - $attributes = \trim(\str_replace("'", "''" , $attributes)); |
|
222 | + $attributes = \trim(\str_replace("'", "''", $attributes)); |
|
223 | 223 | } |
224 | - $columns['attributes'] = "' " . $attributes . " '"; |
|
224 | + $columns['attributes'] = "' ".$attributes." '"; |
|
225 | 225 | |
226 | 226 | return $columns; |
227 | 227 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @param string $options |
235 | 235 | * @return void |
236 | 236 | */ |
237 | - private function getOptions (string $line, string &$options): void |
|
237 | + private function getOptions(string $line, string &$options): void |
|
238 | 238 | { |
239 | 239 | |
240 | 240 | $lineText = \trim(\str_replace([')', ';'], '', $line)); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | if ('' != $options) { |
244 | 244 | $options .= ' '; |
245 | 245 | } |
246 | - $options = "'" . $options . $lineText . "'"; |
|
246 | + $options = "'".$options.$lineText."'"; |
|
247 | 247 | |
248 | 248 | } |
249 | 249 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param string $line |
254 | 254 | * @return array |
255 | 255 | */ |
256 | - private function getKey (string $line) |
|
256 | + private function getKey(string $line) |
|
257 | 257 | { |
258 | 258 | |
259 | 259 | $key = []; |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | if ('' == $name) { |
277 | 277 | $name = $columns; |
278 | 278 | } |
279 | - if (\strpos($name,' ') > 0) { |
|
280 | - $name = "'" . $name . "'"; |
|
279 | + if (\strpos($name, ' ') > 0) { |
|
280 | + $name = "'".$name."'"; |
|
281 | 281 | } |
282 | 282 | $key[$name] = []; |
283 | - if (\strpos($columns,' ') > 0) { |
|
284 | - $columns = "'" . $columns . "'"; |
|
283 | + if (\strpos($columns, ' ') > 0) { |
|
284 | + $columns = "'".$columns."'"; |
|
285 | 285 | } |
286 | 286 | $key[$name]['columns'] = $columns; |
287 | 287 | $key[$name]['unique'] = $unique; |