Completed
Push — master ( b1076e...dd8ca6 )
by Antonio Carlos
06:19
created
src/update/Helper.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function download($url, $directory)
161 161
     {
162
-        coollect((array) $url)->each(function ($url) use ($directory) {
162
+        coollect((array) $url)->each(function($url) use ($directory) {
163 163
             $filename = basename($url);
164 164
 
165 165
             $destination = $this->toDir("{$directory}/{$filename}");
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
         $fw = $this->fopenOrFail($destination, 'w');
218 218
 
219
-        while (! feof($fr)) {
219
+        while (!feof($fr)) {
220 220
             fwrite($fw, fread($fr, 4096));
221 221
             flush();
222 222
         }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         $ch = curl_init();
238 238
         curl_setopt($ch, CURLOPT_URL, $url);
239 239
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
240
-        curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function ($resource, $total, $downloaded) use (&$nextStep) {
240
+        curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($resource, $total, $downloaded) use (&$nextStep) {
241 241
             if ($downloaded > $nextStep) {
242 242
                 echo '.';
243 243
                 $nextStep += 8192;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     protected function renameMasterToPackage($file, $subPath, $path, $exclude)
263 263
     {
264 264
         if (Str::endsWith($file, 'master.zip')) {
265
-            $dir = coollect(scandir($path))->filter(function ($file) use ($exclude) {
265
+            $dir = coollect(scandir($path))->filter(function($file) use ($exclude) {
266 266
                 return $file !== '.' && $file !== '..' && $file !== $exclude;
267 267
             })->first();
268 268
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     {
279 279
         $path = dirname($file);
280 280
 
281
-        if (! Str::endsWith($file, '.zip') || file_exists($subPath = "$path/$subPath")) {
281
+        if (!Str::endsWith($file, '.zip') || file_exists($subPath = "$path/$subPath")) {
282 282
             return;
283 283
         }
284 284
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      */
298 298
     public function delTree($dir)
299 299
     {
300
-        if (! file_exists($dir)) {
300
+        if (!file_exists($dir)) {
301 301
             return false;
302 302
         }
303 303
 
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
 
335 335
         unset($shapeRecords);
336 336
 
337
-        return coollect($result)->mapWithKeys(function ($fields, $key1) {
337
+        return coollect($result)->mapWithKeys(function($fields, $key1) {
338 338
             return [
339
-                strtolower($key1) => coollect($fields)->mapWithKeys(function ($value, $key2) {
339
+                strtolower($key1) => coollect($fields)->mapWithKeys(function($value, $key2) {
340 340
                     return [strtolower($key2) => $value];
341 341
                 }),
342 342
             ];
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 
356 356
         $array = arrayable($array) ? $array->toArray() : $array;
357 357
 
358
-        array_walk($array, function ($value, $key) use (&$result) {
358
+        array_walk($array, function($value, $key) use (&$result) {
359 359
             $result[snake_case($key)] = arrayable($value) || is_array($value)
360 360
                 ? $this->arrayKeysSnakeRecursive($value)
361 361
                 : $value;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      */
384 384
     public function fixUtf8($string)
385 385
     {
386
-        return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) {
386
+        return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function($match) {
387 387
             return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
388 388
         }, $string);
389 389
     }
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
      */
420 420
     public function downloadDataFiles()
421 421
     {
422
-        $this->config->get('downloadable')->each(function ($urls, $path) {
423
-            if (! file_exists($destination = $this->dataDir("third-party/$path"))) {
424
-                coollect($urls)->each(function ($url) use ($path, $destination) {
422
+        $this->config->get('downloadable')->each(function($urls, $path) {
423
+            if (!file_exists($destination = $this->dataDir("third-party/$path"))) {
424
+                coollect($urls)->each(function($url) use ($path, $destination) {
425 425
                     $this->download($url, $destination);
426 426
 
427 427
                     $file = basename($url);
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
      */
492 492
     public function loadJsonFiles($dir)
493 493
     {
494
-        return coollect(glob("$dir/*.json*"))->mapWithKeys(function ($file) {
494
+        return coollect(glob("$dir/*.json*"))->mapWithKeys(function($file) {
495 495
             $key = str_replace('.json', '', str_replace('.json5', '', basename($file)));
496 496
 
497 497
             return [$key => $this->loadJson($file)];
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
      */
525 525
     public function moveDataFiles()
526 526
     {
527
-        $this->config->get('moveable')->each(function ($to, $from) {
527
+        $this->config->get('moveable')->each(function($to, $from) {
528 528
             $this->moveDataFile($from, $to);
529 529
         });
530 530
     }
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
      */
554 554
     public function message($message, $type = 'line')
555 555
     {
556
-        if (! is_null($this->command)) {
556
+        if (!is_null($this->command)) {
557 557
             $this->command->{$type}($message);
558 558
         }
559 559
     }
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
             $this->abort('loadCsv Error: File name not set');
584 584
         }
585 585
 
586
-        if (! file_exists($file)) {
586
+        if (!file_exists($file)) {
587 587
             $file = $this->dataDir($this->addSuffix('.csv', "/$dir/".strtolower($file)));
588 588
         }
589 589
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
      */
600 600
     public function makeJsonFileName($key, $dir = '')
601 601
     {
602
-        if (! Str::endsWith($dir, (DIRECTORY_SEPARATOR))) {
602
+        if (!Str::endsWith($dir, (DIRECTORY_SEPARATOR))) {
603 603
             $dir .= DIRECTORY_SEPARATOR;
604 604
         }
605 605
 
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
     {
681 681
         $this->progress('--- Delete temporary files');
682 682
 
683
-        $this->config->get('deletable')->each(function ($directory) {
683
+        $this->config->get('deletable')->each(function($directory) {
684 684
             if (file_exists($directory = $this->dataDir($directory))) {
685 685
                 $this->deleteDirectory($directory);
686 686
             }
Please login to merge, or discard this patch.
src/package/Data/Repository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     {
149 149
         $this->countriesJson = $this->loadCountriesJson();
150 150
 
151
-        $overload = $this->helper->loadJsonFiles($this->helper->dataDir('countries/overload'))->mapWithKeys(function ($country, $code) {
151
+        $overload = $this->helper->loadJsonFiles($this->helper->dataDir('countries/overload'))->mapWithKeys(function($country, $code) {
152 152
             return [Str::upper($code) => $country];
153 153
         });
154 154
 
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public function currencies()
209 209
     {
210
-        $currencies = $this->helper->loadJsonFiles($this->helper->dataDir('currencies/default'))->mapWithKeys(function ($country, $code) {
210
+        $currencies = $this->helper->loadJsonFiles($this->helper->dataDir('currencies/default'))->mapWithKeys(function($country, $code) {
211 211
             return [Str::upper($code) => $country];
212 212
         });
213 213
 
214
-        $overload = $this->helper->loadJsonFiles($this->helper->dataDir('currencies/overload'))->mapWithKeys(function ($country, $code) {
214
+        $overload = $this->helper->loadJsonFiles($this->helper->dataDir('currencies/overload'))->mapWithKeys(function($country, $code) {
215 215
             return [Str::upper($code) => $country];
216 216
         });
217 217
 
Please login to merge, or discard this patch.