@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function download($url, $directory) |
| 163 | 163 | { |
| 164 | - coollect((array) $url)->each(function ($url) use ($directory) { |
|
| 164 | + coollect((array) $url)->each(function($url) use ($directory) { |
|
| 165 | 165 | $filename = basename($url); |
| 166 | 166 | |
| 167 | 167 | $destination = $this->toDir("{$directory}/{$filename}"); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | $fw = $this->fopenOrFail($destination, 'w'); |
| 220 | 220 | |
| 221 | - while (! feof($fr)) { |
|
| 221 | + while (!feof($fr)) { |
|
| 222 | 222 | fwrite($fw, fread($fr, 4096)); |
| 223 | 223 | flush(); |
| 224 | 224 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $ch = curl_init(); |
| 240 | 240 | curl_setopt($ch, CURLOPT_URL, $url); |
| 241 | 241 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
| 242 | - curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function ($resource, $total, $downloaded) use (&$nextStep) { |
|
| 242 | + curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($resource, $total, $downloaded) use (&$nextStep) { |
|
| 243 | 243 | if ($downloaded > $nextStep) { |
| 244 | 244 | echo '.'; |
| 245 | 245 | $nextStep += 8192; |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | protected function renameMasterToPackage($file, $subPath, $path, $exclude) |
| 265 | 265 | { |
| 266 | 266 | if (Str::endsWith($file, 'master.zip')) { |
| 267 | - $dir = coollect(scandir($path))->filter(function ($file) use ($exclude) { |
|
| 267 | + $dir = coollect(scandir($path))->filter(function($file) use ($exclude) { |
|
| 268 | 268 | return $file !== '.' && $file !== '..' && $file !== $exclude; |
| 269 | 269 | })->first(); |
| 270 | 270 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | { |
| 281 | 281 | $path = dirname($file); |
| 282 | 282 | |
| 283 | - if (! Str::endsWith($file, '.zip') || file_exists($subPath = "$path/$subPath")) { |
|
| 283 | + if (!Str::endsWith($file, '.zip') || file_exists($subPath = "$path/$subPath")) { |
|
| 284 | 284 | return; |
| 285 | 285 | } |
| 286 | 286 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | } else { |
| 296 | 296 | throw new Exception('Cannot unzip'); |
| 297 | 297 | } |
| 298 | - }else{ |
|
| 298 | + } else { |
|
| 299 | 299 | exec("unzip -o $file"); |
| 300 | 300 | } |
| 301 | 301 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function delTree($dir) |
| 312 | 312 | { |
| 313 | - if (! file_exists($dir)) { |
|
| 313 | + if (!file_exists($dir)) { |
|
| 314 | 314 | return false; |
| 315 | 315 | } |
| 316 | 316 | |
@@ -348,9 +348,9 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | unset($shapeRecords); |
| 350 | 350 | |
| 351 | - return coollect($result)->mapWithKeys(function ($fields, $key1) { |
|
| 351 | + return coollect($result)->mapWithKeys(function($fields, $key1) { |
|
| 352 | 352 | return [ |
| 353 | - strtolower($key1) => coollect($fields)->mapWithKeys(function ($value, $key2) { |
|
| 353 | + strtolower($key1) => coollect($fields)->mapWithKeys(function($value, $key2) { |
|
| 354 | 354 | return [strtolower($key2) => $value]; |
| 355 | 355 | }), |
| 356 | 356 | ]; |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | $array = arrayable($array) ? $array->toArray() : $array; |
| 371 | 371 | |
| 372 | - array_walk($array, function ($value, $key) use (&$result) { |
|
| 372 | + array_walk($array, function($value, $key) use (&$result) { |
|
| 373 | 373 | $result[Str::snake($key)] = arrayable($value) || is_array($value) |
| 374 | 374 | ? $this->arrayKeysSnakeRecursive($value) |
| 375 | 375 | : $value; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | public function fixUtf8($string) |
| 399 | 399 | { |
| 400 | - return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) { |
|
| 400 | + return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function($match) { |
|
| 401 | 401 | return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
| 402 | 402 | }, $string); |
| 403 | 403 | } |
@@ -433,9 +433,9 @@ discard block |
||
| 433 | 433 | */ |
| 434 | 434 | public function downloadDataFiles() |
| 435 | 435 | { |
| 436 | - $this->config->get('downloadable')->each(function ($urls, $path) { |
|
| 437 | - if (! file_exists($destination = $this->dataDir("third-party/$path"))) { |
|
| 438 | - coollect($urls)->each(function ($url) use ($destination) { |
|
| 436 | + $this->config->get('downloadable')->each(function($urls, $path) { |
|
| 437 | + if (!file_exists($destination = $this->dataDir("third-party/$path"))) { |
|
| 438 | + coollect($urls)->each(function($url) use ($destination) { |
|
| 439 | 439 | $this->download($url, $destination); |
| 440 | 440 | |
| 441 | 441 | $file = basename($url); |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | */ |
| 506 | 506 | public function loadJsonFiles($dir) |
| 507 | 507 | { |
| 508 | - return coollect(glob("$dir/*.json*"))->mapWithKeys(function ($file) { |
|
| 508 | + return coollect(glob("$dir/*.json*"))->mapWithKeys(function($file) { |
|
| 509 | 509 | $key = str_replace('.json', '', str_replace('.json5', '', basename($file))); |
| 510 | 510 | |
| 511 | 511 | return [$key => $this->loadJson($file)]; |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | */ |
| 539 | 539 | public function moveDataFiles() |
| 540 | 540 | { |
| 541 | - $this->config->get('moveable')->each(function ($to, $from) { |
|
| 541 | + $this->config->get('moveable')->each(function($to, $from) { |
|
| 542 | 542 | $this->moveDataFile($from, $to); |
| 543 | 543 | }); |
| 544 | 544 | } |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | */ |
| 568 | 568 | public function message($message, $type = 'line') |
| 569 | 569 | { |
| 570 | - if (! is_null($this->command)) { |
|
| 570 | + if (!is_null($this->command)) { |
|
| 571 | 571 | $this->command->{$type}($message); |
| 572 | 572 | } |
| 573 | 573 | } |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | $this->abort('loadCsv Error: File name not set'); |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - if (! file_exists($file)) { |
|
| 600 | + if (!file_exists($file)) { |
|
| 601 | 601 | $file = $this->dataDir($this->addSuffix('.csv', "/$dir/".strtolower($file))); |
| 602 | 602 | } |
| 603 | 603 | |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | */ |
| 614 | 614 | public function makeJsonFileName($key, $dir = '') |
| 615 | 615 | { |
| 616 | - if (! Str::endsWith($dir, (DIRECTORY_SEPARATOR))) { |
|
| 616 | + if (!Str::endsWith($dir, (DIRECTORY_SEPARATOR))) { |
|
| 617 | 617 | $dir .= DIRECTORY_SEPARATOR; |
| 618 | 618 | } |
| 619 | 619 | |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | { |
| 695 | 695 | $this->progress('--- Delete temporary files'); |
| 696 | 696 | |
| 697 | - $this->config->get('deletable')->each(function ($directory) { |
|
| 697 | + $this->config->get('deletable')->each(function($directory) { |
|
| 698 | 698 | if (file_exists($directory = $this->dataDir($directory))) { |
| 699 | 699 | $this->deleteDirectory($directory); |
| 700 | 700 | } |
@@ -295,7 +295,7 @@ |
||
| 295 | 295 | } else { |
| 296 | 296 | throw new Exception('Cannot unzip'); |
| 297 | 297 | } |
| 298 | - }else{ |
|
| 298 | + } else{ |
|
| 299 | 299 | exec("unzip -o $file"); |
| 300 | 300 | } |
| 301 | 301 | |