Completed
Push — master ( 79bbce...abd19f )
by Antonio Carlos
07:57 queued 05:51
created
src/package/Services/Helper.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             throw new Exception('loadJson Error: File name not set');
50 50
         }
51 51
 
52
-        if (! file_exists($file) && ! file_exists($file = $this->dataDir("/$dir/".strtolower($file).'.json'))) {
52
+        if (!file_exists($file) && !file_exists($file = $this->dataDir("/$dir/".strtolower($file).'.json'))) {
53 53
             return coollect();
54 54
         }
55 55
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function loadJsonFiles($dir)
72 72
     {
73
-        return coollect(glob("$dir/*.json*"))->mapWithKeys(function ($file) {
73
+        return coollect(glob("$dir/*.json*"))->mapWithKeys(function($file) {
74 74
             $key = str_replace('.json', '', str_replace('.json5', '', basename($file)));
75 75
 
76 76
             return [$key => $this->loadJson($file)];
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function moveFilesWildcard($from, $to)
87 87
     {
88
-        coollect(glob($this->dataDir($from)))->each(function ($from) use ($to) {
88
+        coollect(glob($this->dataDir($from)))->each(function($from) use ($to) {
89 89
             $this->mkDir($dir = $this->dataDir($to));
90 90
 
91 91
             rename($from, $dir.'/'.basename($from));
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     /**
65 65
      * Load json files from dir.
66 66
      *
67
-     * @param $dir
67
+     * @param string $dir
68 68
      * @return \PragmaRX\Coollection\Package\Coollection
69 69
      */
70 70
     public function loadJsonFiles($dir)
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
     /**
108
-     * @param $contents
108
+     * @param string $contents
109 109
      * @return string
110 110
      */
111 111
     public function sanitizeFile($contents)
Please login to merge, or discard this patch.
src/package/Support/Base.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
     public function defineConstants()
8 8
     {
9
-        if (! defined('__COUNTRIES_DIR__')) {
9
+        if (!defined('__COUNTRIES_DIR__')) {
10 10
             define(
11 11
                 '__COUNTRIES_DIR__',
12 12
                 realpath(
Please login to merge, or discard this patch.
src/package/Services/Cache.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      * Delete an item from the cache by its unique key.
120 120
      *
121 121
      * @param string $key
122
-     * @return bool
122
+     * @return boolean|null
123 123
      */
124 124
     public function delete($key)
125 125
     {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      * Get an item from the cache, or store the default value.
208 208
      *
209 209
      * @param  string $key
210
-     * @param  \DateTimeInterface|\DateInterval|float|int $minutes
210
+     * @param  integer $minutes
211 211
      * @param Closure $callback
212 212
      * @return mixed
213 213
      */
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 namespace PragmaRX\Countries\Package\Services;
4 4
 
5 5
 use Closure;
6
-use Psr\SimpleCache\CacheInterface;
7 6
 use PragmaRX\Countries\Package\Services\Cache\Managers\Nette as NetteManager;
7
+use Psr\SimpleCache\CacheInterface;
8 8
 
9 9
 class Cache implements CacheInterface
10 10
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@
 block discarded – undo
203 203
      */
204 204
     public function remember($key, $minutes, Closure $callback)
205 205
     {
206
-        if (! is_null($value = $this->manager->get($key))) {
206
+        if (!is_null($value = $this->manager->get($key))) {
207 207
             return $value;
208 208
         }
209 209
 
Please login to merge, or discard this patch.
src/update/Countries.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
     /**
84 84
      * Build countries collection.
85 85
      *
86
-     * @param $dataDir
86
+     * @param string $dataDir
87 87
      * @return \PragmaRX\Coollection\Package\Coollection
88 88
      */
89 89
     public function buildCountriesCoollection($dataDir)
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace PragmaRX\Countries\Update;
4 4
 
5
-use PragmaRX\Countries\Package\Support\Base;
5
+use PragmaRX\Countries\Package\Countries as CountriesService;
6 6
 use PragmaRX\Countries\Package\Services\Cache;
7 7
 use PragmaRX\Countries\Package\Services\Config;
8
-use PragmaRX\Countries\Package\Countries as CountriesService;
8
+use PragmaRX\Countries\Package\Support\Base;
9 9
 
10 10
 class Countries extends Base
11 11
 {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
         $dataDir = '/countries/default/';
74 74
 
75
-        $this->updater->setCountries($this->cache->remember('updateCountries->buildCountriesCoollection', 160, function () use ($dataDir) {
75
+        $this->updater->setCountries($this->cache->remember('updateCountries->buildCountriesCoollection', 160, function() use ($dataDir) {
76 76
             $this->helper->eraseDataDir($dataDir);
77 77
 
78 78
             return $this->buildCountriesCoollection($dataDir);
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 
105 105
         $this->helper->message('Generating countries...');
106 106
 
107
-        $countries = coollect($shapeFile)->map(function ($country) {
107
+        $countries = coollect($shapeFile)->map(function($country) {
108 108
             return $this->natural->fixNaturalOddCountries($country);
109
-        })->mapWithKeys(function ($natural) use ($mledoze, $dataDir) {
109
+        })->mapWithKeys(function($natural) use ($mledoze, $dataDir) {
110 110
             list($mledoze, $countryCode) = $this->mledoze->findMledozeCountry($mledoze, $natural);
111 111
 
112
-            $natural = coollect($natural)->mapWithKeys(function ($country, $key) {
112
+            $natural = coollect($natural)->mapWithKeys(function($country, $key) {
113 113
                 return [strtolower($key) => $country];
114 114
             });
115 115
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
     public function clearCountryCurrencies($country)
152 152
     {
153
-        if (isset($country['currency']) && ! is_null($country['currency'])) {
153
+        if (isset($country['currency']) && !is_null($country['currency'])) {
154 154
             $country['currencies'] = $country['currency']->keys();
155 155
 
156 156
             unset($country['currency']);
Please login to merge, or discard this patch.
src/update/Mledoze.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace PragmaRX\Countries\Update;
4 4
 
5
-use PragmaRX\Countries\Package\Support\Base;
6 5
 use PragmaRX\Coollection\Package\Coollection;
6
+use PragmaRX\Countries\Package\Support\Base;
7 7
 
8 8
 class Mledoze extends Base
9 9
 {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function loadMledozeCountries()
45 45
     {
46
-        $mledoze = coollect($this->helper->loadJson('countries', 'third-party/mledoze/dist'))->mapWithKeys(function (
46
+        $mledoze = coollect($this->helper->loadJson('countries', 'third-party/mledoze/dist'))->mapWithKeys(function(
47 47
             $country
48 48
         ) {
49 49
             $country = $this->updater->addDataSource($country, 'mledoze');
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         list($country, $countryCode) = $this->updater->findCountryByAnyField($mledoze, $natural);
99 99
 
100
-        if (! $country->isEmpty()) {
100
+        if (!$country->isEmpty()) {
101 101
             return [coollect($this->helper->arrayKeysSnakeRecursive($country)), $countryCode];
102 102
         }
103 103
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
         $result = $this->makeFlag($result);
158 158
 
159
-        return coollect($result)->sortBy(function ($value, $key) {
159
+        return coollect($result)->sortBy(function($value, $key) {
160 160
             return $key;
161 161
         });
162 162
     }
Please login to merge, or discard this patch.
src/package/Services/Cache/Managers/Nette.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         if (is_null($this->dir)) {
56 56
             $this->dir = $this->config->cache->directory ?: sys_get_temp_dir().'/__PRAGMARX_COUNTRIES__/cache';
57 57
 
58
-            if (! file_exists($this->dir)) {
58
+            if (!file_exists($this->dir)) {
59 59
                 mkdir($this->dir, 0755, true);
60 60
             }
61 61
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function getMultiple($keys, $default = null)
145 145
     {
146
-        return coollect($keys)->map(function ($key) {
146
+        return coollect($keys)->map(function($key) {
147 147
             return $this->get($key);
148 148
         });
149 149
     }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function setMultiple($values, $ttl = null)
159 159
     {
160
-        return coollect($values)->map(function ($value, $key) use ($ttl) {
160
+        return coollect($values)->map(function($value, $key) use ($ttl) {
161 161
             return $this->set($key, $value, $ttl);
162 162
         });
163 163
     }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function deleteMultiple($keys)
172 172
     {
173
-        coollect($keys)->map(function ($key) {
173
+        coollect($keys)->map(function($key) {
174 174
             $this->forget($key);
175 175
         });
176 176
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function has($key)
185 185
     {
186
-        return ! is_null($this->get($key));
186
+        return !is_null($this->get($key));
187 187
     }
188 188
 
189 189
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     {
216 216
         $value = $this->get($key);
217 217
 
218
-        if (! is_null($value)) {
218
+        if (!is_null($value)) {
219 219
             return $value;
220 220
         }
221 221
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
      * Delete an item from the cache by its unique key.
135 135
      *
136 136
      * @param string $key
137
-     * @return bool
137
+     * @return boolean|null
138 138
      */
139 139
     public function delete($key)
140 140
     {
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@
 block discarded – undo
3 3
 namespace PragmaRX\Countries\Package\Services\Cache\Managers;
4 4
 
5 5
 use Closure;
6
-use Psr\SimpleCache\CacheInterface;
7 6
 use Nette\Caching\Cache as NetteCache;
8 7
 use Nette\Caching\Storages\FileStorage;
9 8
 use PragmaRX\Countries\Package\Services\Config;
9
+use Psr\SimpleCache\CacheInterface;
10 10
 
11 11
 class Nette implements CacheInterface
12 12
 {
Please login to merge, or discard this patch.
src/package/Services/Hydrator.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     protected function canHydrate($element, $enabled, $countryCode)
65 65
     {
66 66
         return ($enabled || $this->config->get('hydrate.elements.'.$element)) &&
67
-                ! isset($this->repository->countries[$countryCode]['hydrated'][$element]);
67
+                !isset($this->repository->countries[$countryCode]['hydrated'][$element]);
68 68
     }
69 69
 
70 70
     /**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     protected function createHydrated($countryCode)
74 74
     {
75
-        if (! isset($this->repository->countries[$countryCode]['hydrated'])) {
75
+        if (!isset($this->repository->countries[$countryCode]['hydrated'])) {
76 76
             $this->repository->countries[$countryCode]['hydrated'] = [];
77 77
         }
78 78
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     protected function fixCurrencies($country)
83 83
     {
84
-        if (! isset($country['currencies']) && isset($country['currency'])) {
84
+        if (!isset($country['currencies']) && isset($country['currency'])) {
85 85
             $country['currencies'] = $country['currency'];
86 86
         }
87 87
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     private function hydrateCountries($countries, $elements = null)
99 99
     {
100 100
         return countriesCollect(
101
-            $countries->map(function ($country) use ($elements) {
101
+            $countries->map(function($country) use ($elements) {
102 102
                 return $this->hydrateCountry($country, $elements);
103 103
             })
104 104
         );
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     protected function needsHydration($countryCode, $element, $enabled = false)
194 194
     {
195
-        if (! $this->canHydrate($element, $enabled, $countryCode)) {
195
+        if (!$this->canHydrate($element, $enabled, $countryCode)) {
196 196
             return false;
197 197
         }
198 198
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     public function hydrateBorders($country)
306 306
     {
307 307
         $country['borders'] = isset($country['borders'])
308
-            ? $country['borders'] = countriesCollect($country['borders'])->map(function ($border) {
308
+            ? $country['borders'] = countriesCollect($country['borders'])->map(function($border) {
309 309
                 return $this->repository->call('where', ['cca3', $border])->first();
310 310
             })
311 311
             : countriesCollect();
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     {
335 335
         $country = $this->hydrateTimezones($country);
336 336
 
337
-        $country['timezones'] = $country->timezones->map(function ($timezone) {
337
+        $country['timezones'] = $country->timezones->map(function($timezone) {
338 338
             return $timezone->overwrite(['times' => $this->repository->findTimezoneTime($timezone['zone_id'])]);
339 339
         });
340 340
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         $country = $this->fixCurrencies($country);
355 355
 
356 356
         if (isset($country['currencies'])) {
357
-            $currencies = countriesCollect($country['currencies'])->mapWithKeys(function ($code) {
357
+            $currencies = countriesCollect($country['currencies'])->mapWithKeys(function($code) {
358 358
                 if ($this->isCurrenciesArray($code)) {
359 359
                     return [
360 360
                         $code['ISO4217Code'] => $code,
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      */
412 412
     public function addCountry($countryCode, $country)
413 413
     {
414
-        if (! isset($this->repository->countries[$countryCode])) {
414
+        if (!isset($this->repository->countries[$countryCode])) {
415 415
             $this->repository->countries[$countryCode] = $country;
416 416
         }
417 417
     }
@@ -438,14 +438,14 @@  discard block
 block discarded – undo
438 438
      */
439 439
     protected function checkHydrationElements($elements)
440 440
     {
441
-        $elements = countriesCollect($elements)->mapWithKeys(function ($value, $key) {
441
+        $elements = countriesCollect($elements)->mapWithKeys(function($value, $key) {
442 442
             if (is_numeric($key)) {
443 443
                 $key = $value;
444 444
                 $value = true;
445 445
             }
446 446
 
447 447
             return [$key => $value];
448
-        })->filter(function ($element) {
448
+        })->filter(function($element) {
449 449
             return $element;
450 450
         });
451 451
 
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     /**
47 47
      * Hydrator constructor.
48 48
      *
49
-     * @param object $config
49
+     * @param Config $config
50 50
      */
51 51
     public function __construct($config)
52 52
     {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * Can hydrate?
58 58
      *
59 59
      * @param $element
60
-     * @param $enabled
60
+     * @param boolean $enabled
61 61
      * @param $countryCode
62 62
      * @return bool
63 63
      */
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      *
94 94
      * @param $countries
95 95
      * @param $elements
96
-     * @return mixed
96
+     * @return \PragmaRX\Countries\Package\Support\Collection
97 97
      */
98 98
     private function hydrateCountries($countries, $elements = null)
99 99
     {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *
110 110
      * @param $country
111 111
      * @param $elements
112
-     * @return mixed
112
+     * @return \PragmaRX\Countries\Package\Support\Collection
113 113
      */
114 114
     private function hydrateCountry($country, $elements)
115 115
     {
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
      * Get country by country code.
397 397
      *
398 398
      * @param $countryCode
399
-     * @return mixed
399
+     * @return \PragmaRX\Countries\Package\Support\Collection
400 400
      */
401 401
     public function getCountry($countryCode)
402 402
     {
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     /**
456 456
      * Repository setter.
457 457
      *
458
-     * @param $repository
458
+     * @param \PragmaRX\Countries\Package\Data\Repository $repository
459 459
      */
460 460
     public function setRepository($repository)
461 461
     {
Please login to merge, or discard this patch.
src/update/Helper.php 3 patches
Unused Use Statements   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@
 block discarded – undo
3 3
 namespace PragmaRX\Countries\Update;
4 4
 
5 5
 use Exception;
6
-use ReflectionClass;
7
-use ShapeFile\ShapeFile;
8
-use RecursiveIteratorIterator;
9
-use RecursiveDirectoryIterator;
10 6
 use PragmaRX\Countries\Package\Services\Command;
11 7
 use PragmaRX\Countries\Package\Services\Helper as ServiceHelper;
8
+use RecursiveDirectoryIterator;
9
+use RecursiveIteratorIterator;
10
+use ReflectionClass;
11
+use ShapeFile\ShapeFile;
12 12
 
13 13
 class Helper
14 14
 {
Please login to merge, or discard this patch.
Doc Comments   +18 added lines, -13 removed lines patch added patch discarded remove patch
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
     /**
70 70
      * Add suffix to string.
71 71
      *
72
-     * @param $suffix
73
-     * @param $string
74
-     * @return mixed
72
+     * @param string string
73
+     * @param string $string
74
+     * @return string
75 75
      */
76 76
     protected function addSuffix($suffix, $string)
77 77
     {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     /**
99 99
      * Delete a whole directory.
100 100
      *
101
-     * @param $dir
101
+     * @param string $dir
102 102
      */
103 103
     protected function deleteDirectory($dir)
104 104
     {
@@ -116,6 +116,11 @@  discard block
 block discarded – undo
116 116
         rmdir($dir);
117 117
     }
118 118
 
119
+    /**
120
+     * @param string $string
121
+     *
122
+     * @return resource
123
+     */
119 124
     protected function fopenOrFail($url, $string)
120 125
     {
121 126
         if (($handle = @fopen($url, $string)) === false) {
@@ -184,7 +189,7 @@  discard block
 block discarded – undo
184 189
 
185 190
     /**
186 191
      * @param $url
187
-     * @param $destination
192
+     * @param string $destination
188 193
      */
189 194
     public function downloadFile($url, $destination)
190 195
     {
@@ -255,8 +260,8 @@  discard block
 block discarded – undo
255 260
     /**
256 261
      * @param $file
257 262
      * @param $subPath
258
-     * @param $path
259
-     * @param $exclude
263
+     * @param string $path
264
+     * @param string $exclude
260 265
      */
261 266
     protected function renameMasterToPackage($file, $subPath, $path, $exclude)
262 267
     {
@@ -310,8 +315,8 @@  discard block
 block discarded – undo
310 315
     /**
311 316
      * Load a shapeFile.
312 317
      *
313
-     * @param $dir
314
-     * @return \PragmaRX\Coollection\Package\Coollection
318
+     * @param string $dir
319
+     * @return string
315 320
      */
316 321
     public function shapeFile($dir)
317 322
     {
@@ -391,7 +396,7 @@  discard block
 block discarded – undo
391 396
      * Unzip a file.
392 397
      *
393 398
      * @param $file
394
-     * @param $path
399
+     * @param string $path
395 400
      */
396 401
     public function unzip($file, $path)
397 402
     {
@@ -483,7 +488,7 @@  discard block
 block discarded – undo
483 488
     /**
484 489
      * Load json files from dir.
485 490
      *
486
-     * @param $dir
491
+     * @param string $dir
487 492
      * @return \PragmaRX\Coollection\Package\Coollection
488 493
      */
489 494
     public function loadJsonFiles($dir)
@@ -569,7 +574,7 @@  discard block
 block discarded – undo
569 574
     /**
570 575
      * Loads a json file.
571 576
      *
572
-     * @param $file
577
+     * @param string $file
573 578
      * @param string $dir
574 579
      * @return \PragmaRX\Coollection\Package\Coollection
575 580
      * @throws \Exception
@@ -606,7 +611,7 @@  discard block
 block discarded – undo
606 611
     /**
607 612
      * Put contents into a file.
608 613
      *
609
-     * @param $file
614
+     * @param string $file
610 615
      * @param $contents
611 616
      */
612 617
     public function putFile($file, $contents)
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     public function download($url, $directory)
160 160
     {
161
-        coollect((array) $url)->each(function ($url) use ($directory) {
161
+        coollect((array) $url)->each(function($url) use ($directory) {
162 162
             $filename = basename($url);
163 163
 
164 164
             $destination = $this->toDir("{$directory}/{$filename}");
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
         $fw = $this->fopenOrFail($destination, 'w');
217 217
 
218
-        while (! feof($fr)) {
218
+        while (!feof($fr)) {
219 219
             fwrite($fw, fread($fr, 4096));
220 220
             flush();
221 221
         }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         $ch = curl_init();
237 237
         curl_setopt($ch, CURLOPT_URL, $url);
238 238
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
239
-        curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function ($resource, $total, $downloaded) use (&$nextStep) {
239
+        curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($resource, $total, $downloaded) use (&$nextStep) {
240 240
             if ($downloaded > $nextStep) {
241 241
                 echo '.';
242 242
                 $nextStep += 8192;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     protected function renameMasterToPackage($file, $subPath, $path, $exclude)
262 262
     {
263 263
         if (ends_with($file, 'master.zip')) {
264
-            $dir = coollect(scandir($path))->filter(function ($file) use ($exclude) {
264
+            $dir = coollect(scandir($path))->filter(function($file) use ($exclude) {
265 265
                 return $file !== '.' && $file !== '..' && $file !== $exclude;
266 266
             })->first();
267 267
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     {
278 278
         $path = dirname($file);
279 279
 
280
-        if (! ends_with($file, '.zip') || file_exists($subPath = "$path/$subPath")) {
280
+        if (!ends_with($file, '.zip') || file_exists($subPath = "$path/$subPath")) {
281 281
             return;
282 282
         }
283 283
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      */
297 297
     public function delTree($dir)
298 298
     {
299
-        if (! file_exists($dir)) {
299
+        if (!file_exists($dir)) {
300 300
             return false;
301 301
         }
302 302
 
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
 
334 334
         unset($shapeRecords);
335 335
 
336
-        return coollect($result)->mapWithKeys(function ($fields, $key1) {
336
+        return coollect($result)->mapWithKeys(function($fields, $key1) {
337 337
             return [
338
-                strtolower($key1) => coollect($fields)->mapWithKeys(function ($value, $key2) {
338
+                strtolower($key1) => coollect($fields)->mapWithKeys(function($value, $key2) {
339 339
                     return [strtolower($key2) => $value];
340 340
                 }),
341 341
             ];
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 
355 355
         $array = arrayable($array) ? $array->toArray() : $array;
356 356
 
357
-        array_walk($array, function ($value, $key) use (&$result) {
357
+        array_walk($array, function($value, $key) use (&$result) {
358 358
             $result[snake_case($key)] = arrayable($value) || is_array($value)
359 359
                 ? $this->arrayKeysSnakeRecursive($value)
360 360
                 : $value;
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
      */
383 383
     public function fixUtf8($string)
384 384
     {
385
-        return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) {
385
+        return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function($match) {
386 386
             return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
387 387
         }, $string);
388 388
     }
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
      */
419 419
     public function downloadDataFiles()
420 420
     {
421
-        $this->config->get('downloadable')->each(function ($urls, $path) {
422
-            if (! file_exists($destination = $this->dataDir("third-party/$path"))) {
423
-                coollect($urls)->each(function ($url) use ($path, $destination) {
421
+        $this->config->get('downloadable')->each(function($urls, $path) {
422
+            if (!file_exists($destination = $this->dataDir("third-party/$path"))) {
423
+                coollect($urls)->each(function($url) use ($path, $destination) {
424 424
                     $this->download($url, $destination);
425 425
 
426 426
                     $file = basename($url);
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
      */
489 489
     public function loadJsonFiles($dir)
490 490
     {
491
-        return coollect(glob("$dir/*.json*"))->mapWithKeys(function ($file) {
491
+        return coollect(glob("$dir/*.json*"))->mapWithKeys(function($file) {
492 492
             $key = str_replace('.json', '', str_replace('.json5', '', basename($file)));
493 493
 
494 494
             return [$key => $this->loadJson($file)];
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
      */
522 522
     public function moveDataFiles()
523 523
     {
524
-        $this->config->get('moveable')->each(function ($to, $from) {
524
+        $this->config->get('moveable')->each(function($to, $from) {
525 525
             $this->moveDataFile($from, $to);
526 526
         });
527 527
     }
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
      */
551 551
     public function message($message, $type = 'line')
552 552
     {
553
-        if (! is_null($this->command)) {
553
+        if (!is_null($this->command)) {
554 554
             $this->command->{$type}($message);
555 555
         }
556 556
     }
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
             $this->abort('loadCsv Error: File name not set');
581 581
         }
582 582
 
583
-        if (! file_exists($file)) {
583
+        if (!file_exists($file)) {
584 584
             $file = $this->dataDir($this->addSuffix('.csv', "/$dir/".strtolower($file)));
585 585
         }
586 586
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
      */
597 597
     public function makeJsonFileName($key, $dir = '')
598 598
     {
599
-        if (! ends_with($dir, (DIRECTORY_SEPARATOR))) {
599
+        if (!ends_with($dir, (DIRECTORY_SEPARATOR))) {
600 600
             $dir .= DIRECTORY_SEPARATOR;
601 601
         }
602 602
 
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
     {
678 678
         $this->progress('--- Delete temporary files');
679 679
 
680
-        $this->config->get('deletable')->each(function ($directory) {
680
+        $this->config->get('deletable')->each(function($directory) {
681 681
             if (file_exists($directory = $this->dataDir($directory))) {
682 682
                 $this->deleteDirectory($directory);
683 683
             }
Please login to merge, or discard this patch.
src/update/Nationality.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace PragmaRX\Countries\Update;
4 4
 
5
-use PragmaRX\Countries\Package\Support\Base;
6 5
 use PragmaRX\Coollection\Package\Coollection;
6
+use PragmaRX\Countries\Package\Support\Base;
7 7
 
8 8
 class Nationality extends Base
9 9
 {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function load()
37 37
     {
38
-        $mledoze = coollect($this->helper->loadJson('countries', 'third-party/mledoze/dist'))->mapWithKeys(function (
38
+        $mledoze = coollect($this->helper->loadJson('countries', 'third-party/mledoze/dist'))->mapWithKeys(function(
39 39
             $country
40 40
         ) {
41 41
             $country = $this->updater->addDataSource($country, 'mledoze');
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     {
90 90
         list($country, $countryCode) = $this->updater->findCountryByAnyField($mledoze, $natural);
91 91
 
92
-        if (! $country->isEmpty()) {
92
+        if (!$country->isEmpty()) {
93 93
             return [coollect($this->helper->arrayKeysSnakeRecursive($country)), $countryCode];
94 94
         }
95 95
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             $result[$key] = $mledozeValue; // Natural Earth Vector
138 138
         }
139 139
 
140
-        return coollect($result)->sortBy(function ($value, $key) {
140
+        return coollect($result)->sortBy(function($value, $key) {
141 141
             return $key;
142 142
         });
143 143
     }
Please login to merge, or discard this patch.