@@ -72,7 +72,7 @@ discard block |
||
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 |
||
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 | [$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 |
||
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']); |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | { |
107 | 107 | $instance = $this; |
108 | 108 | |
109 | - Coollection::macro('hydrate', function ($elements = null) use ($instance) { |
|
109 | + Coollection::macro('hydrate', function($elements = null) use ($instance) { |
|
110 | 110 | return $instance->hydrate($this, $elements); |
111 | 111 | }); |
112 | 112 | |
113 | 113 | foreach (Hydrator::HYDRATORS as $hydrator) { |
114 | 114 | $hydrator = 'hydrate'.Str::studly($hydrator); |
115 | 115 | |
116 | - Coollection::macro($hydrator, function () use ($hydrator, $instance) { |
|
116 | + Coollection::macro($hydrator, function() use ($hydrator, $instance) { |
|
117 | 117 | return $instance->getRepository()->getHydrator()->{$hydrator}($this); |
118 | 118 | }); |
119 | 119 | } |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | */ |
180 | 180 | protected function instantiateCache(Cache $cache = null) |
181 | 181 | { |
182 | - if (\is_null($this->cache) || ! \is_null($cache)) { |
|
183 | - $this->cache = ! \is_null($cache) |
|
182 | + if (\is_null($this->cache) || !\is_null($cache)) { |
|
183 | + $this->cache = !\is_null($cache) |
|
184 | 184 | ? $cache |
185 | 185 | : new Cache($this->config); |
186 | 186 | } |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | */ |
197 | 197 | protected function instantiateConfig($config = null) |
198 | 198 | { |
199 | - if (\is_null($this->config) || ! \is_null($config)) { |
|
200 | - $this->config = ! \is_null($config) |
|
199 | + if (\is_null($this->config) || !\is_null($config)) { |
|
200 | + $this->config = !\is_null($config) |
|
201 | 201 | ? $config |
202 | 202 | : new Config($this->helper); |
203 | 203 | } |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | */ |
229 | 229 | protected function instantiateHydrator(Hydrator $hydrator = null) |
230 | 230 | { |
231 | - if (\is_null($this->hydrator) || ! \is_null($hydrator)) { |
|
232 | - $this->hydrator = ! \is_null($hydrator) |
|
231 | + if (\is_null($this->hydrator) || !\is_null($hydrator)) { |
|
232 | + $this->hydrator = !\is_null($hydrator) |
|
233 | 233 | ? $hydrator |
234 | 234 | : new Hydrator($this->config); |
235 | 235 | } |
@@ -148,7 +148,7 @@ discard block |
||
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 |
||
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 |
@@ -64,7 +64,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
354 | 354 | $country = $this->fixCurrencies($country); |
355 | 355 | |
356 | 356 | if (isset($country['currencies'])) { |
357 | - $currencies = countriesCollect($country['currencies'])->mapWithKeys(function ($code, $currencyCode) { |
|
357 | + $currencies = countriesCollect($country['currencies'])->mapWithKeys(function($code, $currencyCode) { |
|
358 | 358 | if ($this->isCurrenciesArray($code)) { |
359 | 359 | return [ |
360 | 360 | $code['ISO4217Code'] => $code, |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | */ |
416 | 416 | public function addCountry($countryCode, $country) |
417 | 417 | { |
418 | - if (! isset($this->repository->countries[$countryCode])) { |
|
418 | + if (!isset($this->repository->countries[$countryCode])) { |
|
419 | 419 | $this->repository->countries[$countryCode] = $country; |
420 | 420 | } |
421 | 421 | } |
@@ -442,14 +442,14 @@ discard block |
||
442 | 442 | */ |
443 | 443 | protected function checkHydrationElements($elements) |
444 | 444 | { |
445 | - $elements = countriesCollect($elements)->mapWithKeys(function ($value, $key) { |
|
445 | + $elements = countriesCollect($elements)->mapWithKeys(function($value, $key) { |
|
446 | 446 | if (is_numeric($key)) { |
447 | 447 | $key = $value; |
448 | 448 | $value = true; |
449 | 449 | } |
450 | 450 | |
451 | 451 | return [$key => $value]; |
452 | - })->filter(function ($element) { |
|
452 | + })->filter(function($element) { |
|
453 | 453 | return $element; |
454 | 454 | }); |
455 | 455 |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $record = $record->toArray(); |
210 | 210 | } |
211 | 211 | |
212 | - if (! isset($record[$field = 'data_sources'])) { |
|
212 | + if (!isset($record[$field = 'data_sources'])) { |
|
213 | 213 | $record['data_sources'] = []; |
214 | 214 | } |
215 | 215 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | foreach ($fields as $field) { |
268 | 268 | $found = $on->where($field[0], $by[$field[1]])->first(); |
269 | 269 | |
270 | - if (isset($by[$field[1]]) && ! is_null($found) && $found->count() > 0) { |
|
270 | + if (isset($by[$field[1]]) && !is_null($found) && $found->count() > 0) { |
|
271 | 271 | return [coollect($found), $found->{$codeField}]; |
272 | 272 | } |
273 | 273 | } |
@@ -285,19 +285,19 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function generateAllJsonFiles($dir, $makeGroupKeyClosure, $records, $groupKey) |
287 | 287 | { |
288 | - if (! empty($groupKey)) { |
|
288 | + if (!empty($groupKey)) { |
|
289 | 289 | $records = $records->groupBy($groupKey); |
290 | 290 | } |
291 | 291 | |
292 | - $records->each(function (Coollection $record, $key) use ($dir, $makeGroupKeyClosure) { |
|
292 | + $records->each(function(Coollection $record, $key) use ($dir, $makeGroupKeyClosure) { |
|
293 | 293 | $this->helper->mkdir(dirname($file = $this->helper->makeJsonFileName($key, $dir))); |
294 | 294 | |
295 | - $record = $record->mapWithKeys(function ($record, $key) use ($makeGroupKeyClosure) { |
|
295 | + $record = $record->mapWithKeys(function($record, $key) use ($makeGroupKeyClosure) { |
|
296 | 296 | $key = is_null($makeGroupKeyClosure) |
297 | 297 | ? $key |
298 | 298 | : $makeGroupKeyClosure($record, $key); |
299 | 299 | |
300 | - $record = coollect($record)->sortBy(function ($value, $key) { |
|
300 | + $record = coollect($record)->sortBy(function($value, $key) { |
|
301 | 301 | return $key; |
302 | 302 | }); |
303 | 303 | |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | return $this->cache->remember( |
352 | 352 | 'normalizeData'.$dir, |
353 | 353 | 160, |
354 | - function () use ($result, $normalizerClosure, &$counter) { |
|
355 | - return coollect($result)->map(function ($item, $key) use ($normalizerClosure, &$counter) { |
|
354 | + function() use ($result, $normalizerClosure, &$counter) { |
|
355 | + return coollect($result)->map(function($item, $key) use ($normalizerClosure, &$counter) { |
|
356 | 356 | if ($counter++ % 1000 === 0) { |
357 | 357 | $this->helper->message("Normalized: {$counter}"); |
358 | 358 | } |
359 | 359 | |
360 | - return $normalizerClosure(coollect($item)->mapWithKeys(function ($value, $key) { |
|
360 | + return $normalizerClosure(coollect($item)->mapWithKeys(function($value, $key) { |
|
361 | 361 | return [strtolower($key) => $value]; |
362 | 362 | }), $key); |
363 | 363 | }); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $countryCode = $this->helper->caseForKey($item['name']); |
387 | 387 | } |
388 | 388 | |
389 | - $item['iso_a3'] = ! isset($item['iso_a3']) |
|
389 | + $item['iso_a3'] = !isset($item['iso_a3']) |
|
390 | 390 | ? $countryCode |
391 | 391 | : $item['iso_a3']; |
392 | 392 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'latlng' => 'geo', |
61 | 61 | ]; |
62 | 62 | |
63 | - coollect($mergeable)->each(function ($to, $key) use (&$natural) { |
|
63 | + coollect($mergeable)->each(function($to, $key) use (&$natural) { |
|
64 | 64 | if (isset($natural[$key])) { |
65 | 65 | $natural->overwrite([$to => [$key => $natural[$key]]]); |
66 | 66 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function findRinvexState($country, $needle) |
114 | 114 | { |
115 | - $states = $this->findRinvex($country, 'divisions')->map(function ($state, $postal) { |
|
115 | + $states = $this->findRinvex($country, 'divisions')->map(function($state, $postal) { |
|
116 | 116 | $state['postal'] = $postal; |
117 | 117 | |
118 | 118 | $state['name'] = $this->helper->fixUtf8($state['name']); |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | return $states; |
125 | 125 | } |
126 | 126 | |
127 | - $state = $states->filter(function ($rinvexState) use ($needle) { |
|
127 | + $state = $states->filter(function($rinvexState) use ($needle) { |
|
128 | 128 | return $rinvexState->postal == $needle->postal || |
129 | 129 | $rinvexState->name == $needle['name'] || |
130 | 130 | utf8_encode($rinvexState->name) == $needle['name'] || |
131 | 131 | $rinvexState->alt_names->contains($needle['name']) || |
132 | - $rinvexState->alt_names->contains(function ($name) use ($needle) { |
|
132 | + $rinvexState->alt_names->contains(function($name) use ($needle) { |
|
133 | 133 | return $needle->alt_names->contains($name); |
134 | 134 | }); |
135 | 135 | })->first(); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | continue; |
205 | 205 | } |
206 | 206 | |
207 | - if ($rinvexValue !== $naturalValue && ! $defaultToRinvex->contains($key)) { |
|
207 | + if ($rinvexValue !== $naturalValue && !$defaultToRinvex->contains($key)) { |
|
208 | 208 | $result[$key.$suffix] = $rinvexValue; // Natural Earth Vector |
209 | 209 | } |
210 | 210 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | : $naturalValue; // Natural Earth Vector |
214 | 214 | } |
215 | 215 | |
216 | - return coollect($result)->sortBy(function ($value, $key) { |
|
216 | + return coollect($result)->sortBy(function($value, $key) { |
|
217 | 217 | return $key; |
218 | 218 | }); |
219 | 219 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function mergeCountryStatesWithRinvex($states) |
228 | 228 | { |
229 | - return coollect($states)->map(function ($state) { |
|
229 | + return coollect($states)->map(function($state) { |
|
230 | 230 | return $this->mergeStateWithRinvex($state); |
231 | 231 | }); |
232 | 232 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function download($url, $directory) |
165 | 165 | { |
166 | - coollect((array) $url)->each(function ($url) use ($directory) { |
|
166 | + coollect((array) $url)->each(function($url) use ($directory) { |
|
167 | 167 | $filename = basename($url); |
168 | 168 | |
169 | 169 | $destination = $this->toDir("{$directory}/{$filename}"); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | $fw = $this->fopenOrFail($destination, 'w'); |
222 | 222 | |
223 | - while (! feof($fr)) { |
|
223 | + while (!feof($fr)) { |
|
224 | 224 | fwrite($fw, fread($fr, 4096)); |
225 | 225 | flush(); |
226 | 226 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $ch = curl_init(); |
242 | 242 | curl_setopt($ch, CURLOPT_URL, $url); |
243 | 243 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
244 | - curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function ($resource, $total, $downloaded) use (&$nextStep) { |
|
244 | + curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($resource, $total, $downloaded) use (&$nextStep) { |
|
245 | 245 | if ($downloaded > $nextStep) { |
246 | 246 | echo '.'; |
247 | 247 | $nextStep += 8192; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | protected function renameMasterToPackage($file, $subPath, $path, $exclude) |
267 | 267 | { |
268 | 268 | if (Str::endsWith($file, 'master.zip')) { |
269 | - $dir = coollect(scandir($path))->filter(function ($file) use ($exclude) { |
|
269 | + $dir = coollect(scandir($path))->filter(function($file) use ($exclude) { |
|
270 | 270 | return $file !== '.' && $file !== '..' && $file !== $exclude; |
271 | 271 | })->first(); |
272 | 272 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | { |
283 | 283 | $path = dirname($file); |
284 | 284 | |
285 | - if (! Str::endsWith($file, '.zip') || file_exists($subPath = "$path/$subPath")) { |
|
285 | + if (!Str::endsWith($file, '.zip') || file_exists($subPath = "$path/$subPath")) { |
|
286 | 286 | return; |
287 | 287 | } |
288 | 288 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public function delTree($dir) |
314 | 314 | { |
315 | - if (! file_exists($dir)) { |
|
315 | + if (!file_exists($dir)) { |
|
316 | 316 | return false; |
317 | 317 | } |
318 | 318 | |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | |
351 | 351 | unset($shapeRecords); |
352 | 352 | |
353 | - return coollect($result)->mapWithKeys(function ($fields, $key1) { |
|
353 | + return coollect($result)->mapWithKeys(function($fields, $key1) { |
|
354 | 354 | return [ |
355 | - strtolower($key1) => coollect($fields)->mapWithKeys(function ($value, $key2) { |
|
355 | + strtolower($key1) => coollect($fields)->mapWithKeys(function($value, $key2) { |
|
356 | 356 | return [strtolower($key2) => $value]; |
357 | 357 | }), |
358 | 358 | ]; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | $array = arrayable($array) ? $array->toArray() : $array; |
373 | 373 | |
374 | - array_walk($array, function ($value, $key) use (&$result) { |
|
374 | + array_walk($array, function($value, $key) use (&$result) { |
|
375 | 375 | $result[Str::snake($key)] = arrayable($value) || is_array($value) |
376 | 376 | ? $this->arrayKeysSnakeRecursive($value) |
377 | 377 | : $value; |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | */ |
400 | 400 | public function fixUtf8($string) |
401 | 401 | { |
402 | - return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) { |
|
402 | + return preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function($match) { |
|
403 | 403 | return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
404 | 404 | }, $string); |
405 | 405 | } |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | */ |
436 | 436 | public function downloadDataFiles() |
437 | 437 | { |
438 | - $this->config->get('downloadable')->each(function ($urls, $path) { |
|
439 | - if (! file_exists($destination = $this->dataDir("third-party/$path"))) { |
|
440 | - coollect($urls)->each(function ($url) use ($destination) { |
|
438 | + $this->config->get('downloadable')->each(function($urls, $path) { |
|
439 | + if (!file_exists($destination = $this->dataDir("third-party/$path"))) { |
|
440 | + coollect($urls)->each(function($url) use ($destination) { |
|
441 | 441 | $this->download($url, $destination); |
442 | 442 | |
443 | 443 | $file = basename($url); |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | public function loadJsonFiles($dir) |
509 | 509 | { |
510 | - return coollect(glob("$dir/*.json*"))->mapWithKeys(function ($file) { |
|
510 | + return coollect(glob("$dir/*.json*"))->mapWithKeys(function($file) { |
|
511 | 511 | $key = str_replace('.json', '', str_replace('.json5', '', basename($file))); |
512 | 512 | |
513 | 513 | return [$key => $this->loadJson($file)]; |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | */ |
541 | 541 | public function moveDataFiles() |
542 | 542 | { |
543 | - $this->config->get('moveable')->each(function ($to, $from) { |
|
543 | + $this->config->get('moveable')->each(function($to, $from) { |
|
544 | 544 | $this->moveDataFile($from, $to); |
545 | 545 | }); |
546 | 546 | } |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | */ |
570 | 570 | public function message($message, $type = 'line') |
571 | 571 | { |
572 | - if (! is_null($this->command)) { |
|
572 | + if (!is_null($this->command)) { |
|
573 | 573 | $this->command->{$type}($message); |
574 | 574 | } |
575 | 575 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | $this->abort('loadCsv Error: File name not set'); |
601 | 601 | } |
602 | 602 | |
603 | - if (! file_exists($file)) { |
|
603 | + if (!file_exists($file)) { |
|
604 | 604 | $file = $this->dataDir($this->addSuffix('.csv', "/$dir/".strtolower($file))); |
605 | 605 | } |
606 | 606 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | */ |
617 | 617 | public function makeJsonFileName($key, $dir = '') |
618 | 618 | { |
619 | - if (! Str::endsWith($dir, DIRECTORY_SEPARATOR)) { |
|
619 | + if (!Str::endsWith($dir, DIRECTORY_SEPARATOR)) { |
|
620 | 620 | $dir .= DIRECTORY_SEPARATOR; |
621 | 621 | } |
622 | 622 | |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | { |
698 | 698 | $this->progress('--- Delete temporary files'); |
699 | 699 | |
700 | - $this->config->get('deletable')->each(function ($directory) { |
|
700 | + $this->config->get('deletable')->each(function($directory) { |
|
701 | 701 | if (file_exists($directory = $this->dataDir($directory))) { |
702 | 702 | $this->deleteDirectory($directory); |
703 | 703 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $countries = $this->cache->remember( |
52 | 52 | 'updateTimezone.countries', |
53 | 53 | 160, |
54 | - function () { |
|
54 | + function() { |
|
55 | 55 | return $this->helper->loadCsv($this->helper->dataDir('third-party/timezonedb/country.csv')); |
56 | 56 | } |
57 | 57 | ); |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | $zones = $this->cache->remember( |
62 | 62 | 'updateTimezone.zones', |
63 | 63 | 160, |
64 | - function () { |
|
65 | - return $this->helper->loadCsv($this->helper->dataDir('third-party/timezonedb/zone.csv'))->mapWithKeys(function ($value) { |
|
64 | + function() { |
|
65 | + return $this->helper->loadCsv($this->helper->dataDir('third-party/timezonedb/zone.csv'))->mapWithKeys(function($value) { |
|
66 | 66 | return [ |
67 | 67 | $value[0] => [ |
68 | 68 | 'zone_id' => $value[0], |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | $timezones = $this->cache->remember( |
80 | 80 | 'updateTimezone.timezones', |
81 | 81 | 160, |
82 | - function () { |
|
83 | - return $this->helper->loadCsv($this->helper->dataDir('third-party/timezonedb/timezone.csv'))->map(function ($timezone) { |
|
82 | + function() { |
|
83 | + return $this->helper->loadCsv($this->helper->dataDir('third-party/timezonedb/timezone.csv'))->map(function($timezone) { |
|
84 | 84 | return [ |
85 | 85 | 'zone_id' => $timezone[0], |
86 | 86 | 'abbreviation' => $timezone[1], |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | $abbreviations = $this->cache->remember( |
98 | 98 | 'updateTimezone.abbreviations', |
99 | 99 | 160, |
100 | - function () use ($timezones) { |
|
101 | - return $timezones->groupBy('zone_id')->map(function (Coollection $timezones) { |
|
102 | - return $timezones->map(function ($timezone) { |
|
100 | + function() use ($timezones) { |
|
101 | + return $timezones->groupBy('zone_id')->map(function(Coollection $timezones) { |
|
102 | + return $timezones->map(function($timezone) { |
|
103 | 103 | return $timezone['abbreviation']; |
104 | 104 | })->unique()->sort()->values(); |
105 | 105 | }); |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | |
109 | 109 | $this->helper->progress('Updating countries timezones...'); |
110 | 110 | |
111 | - $countries = $countries->mapWithKeys(function ($item) { |
|
111 | + $countries = $countries->mapWithKeys(function($item) { |
|
112 | 112 | return [$item[0] => [ |
113 | 113 | 'cca2' => $item[0], |
114 | 114 | 'name' => $item[1], |
115 | 115 | ]]; |
116 | 116 | }) |
117 | - ->mapWithKeys(function ($item, $cca2) { |
|
117 | + ->mapWithKeys(function($item, $cca2) { |
|
118 | 118 | $fields = [ |
119 | 119 | ['cca2', 'cca2'], |
120 | 120 | ['name.common', 'name'], |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | 'name' => $item['name'], |
135 | 135 | ], |
136 | 136 | ]; |
137 | - })->map(function ($country) use ($zones, $abbreviations) { |
|
138 | - $country['timezones'] = $zones->where('country_code', $country['cca2'])->mapWithKeys(function ($zone) use ($abbreviations, $country) { |
|
137 | + })->map(function($country) use ($zones, $abbreviations) { |
|
138 | + $country['timezones'] = $zones->where('country_code', $country['cca2'])->mapWithKeys(function($zone) use ($abbreviations, $country) { |
|
139 | 139 | $zone['abbreviations'] = $abbreviations[$zone['zone_id']]; |
140 | 140 | |
141 | 141 | $zone['cca3'] = isset($country['cca3']) ? $country['cca3'] : null; |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | |
155 | 155 | $this->helper->message('Generating timezone files...'); |
156 | 156 | |
157 | - $getCountryCodeClosure = function () { |
|
157 | + $getCountryCodeClosure = function() { |
|
158 | 158 | }; |
159 | 159 | |
160 | - $normalizeCountryClosure = function ($country) { |
|
160 | + $normalizeCountryClosure = function($country) { |
|
161 | 161 | return [$country['timezones']]; |
162 | 162 | }; |
163 | 163 | |
164 | - $dummyClosure = function ($country) { |
|
164 | + $dummyClosure = function($country) { |
|
165 | 165 | return $country; |
166 | 166 | }; |
167 | 167 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param null $ttl |
125 | 125 | * @return bool |
126 | 126 | */ |
127 | - public function set(string $key, mixed $value, DateInterval|int|null $ttl = null): bool |
|
127 | + public function set(string $key, mixed $value, DateInterval | int | null $ttl = null): bool |
|
128 | 128 | { |
129 | 129 | if ($this->enabled()) { |
130 | 130 | return $this->manager->set($key, $value, $ttl); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param null $default |
162 | 162 | * @return array |
163 | 163 | */ |
164 | - public function getMultiple(Traversable|array $keys, mixed $default = null): Traversable|array |
|
164 | + public function getMultiple(Traversable | array $keys, mixed $default = null): Traversable | array |
|
165 | 165 | { |
166 | 166 | return $this->manager->getMultiple($keys, $default); |
167 | 167 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param null $ttl |
174 | 174 | * @return bool |
175 | 175 | */ |
176 | - public function setMultiple(Traversable|array $values, DateInterval|int|null $ttl = null): bool |
|
176 | + public function setMultiple(Traversable | array $values, DateInterval | int | null $ttl = null): bool |
|
177 | 177 | { |
178 | 178 | return $this->manager->setMultiple($values, $ttl); |
179 | 179 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @param $keys |
185 | 185 | * @return bool|void |
186 | 186 | */ |
187 | - public function deleteMultiple(Traversable|array $keys): bool |
|
187 | + public function deleteMultiple(Traversable | array $keys): bool |
|
188 | 188 | { |
189 | 189 | return $this->manager->deleteMultiple($keys); |
190 | 190 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function remember($key, $minutes, Closure $callback) |
212 | 212 | { |
213 | - if (! \is_null($value = $this->manager->get($key))) { |
|
213 | + if (!\is_null($value = $this->manager->get($key))) { |
|
214 | 214 | return $value; |
215 | 215 | } |
216 | 216 |