@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | throw new Exception('loadJson Error: File name not set'); |
49 | 49 | } |
50 | 50 | |
51 | - if (! file_exists($file) && ! file_exists($file = $this->dataDir("/$dir/".strtolower($file).'.json'))) { |
|
51 | + if (!file_exists($file) && !file_exists($file = $this->dataDir("/$dir/".strtolower($file).'.json'))) { |
|
52 | 52 | return coollect(); |
53 | 53 | } |
54 | 54 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function loadJsonFiles($dir) |
71 | 71 | { |
72 | - return coollect(glob("$dir/*.json*"))->mapWithKeys(function ($file) { |
|
72 | + return coollect(glob("$dir/*.json*"))->mapWithKeys(function($file) { |
|
73 | 73 | $key = str_replace(['.json5', '.json'], '', basename($file)); |
74 | 74 | |
75 | 75 | return [$key => $this->loadJson($file)]; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function moveFilesWildcard($from, $to) |
86 | 86 | { |
87 | - coollect(glob($this->dataDir($from)))->each(function ($from) use ($to) { |
|
87 | + coollect(glob($this->dataDir($from)))->each(function($from) use ($to) { |
|
88 | 88 | $this->mkDir($dir = $this->dataDir($to)); |
89 | 89 | |
90 | 90 | rename($from, $dir.'/'.basename($from)); |
@@ -35,7 +35,7 @@ discard block |
||
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 |
||
89 | 89 | { |
90 | 90 | [$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 |
||
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 | } |
@@ -43,7 +43,7 @@ discard block |
||
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 |
||
97 | 97 | { |
98 | 98 | [$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 |
||
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 | } |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -159,7 +159,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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[Str::snake($key)] = arrayable($value) || is_array($value) |
360 | 360 | ? $this->arrayKeysSnakeRecursive($value) |
361 | 361 | : $value; |
@@ -383,7 +383,7 @@ discard block |
||
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 |
||
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 ($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 ($destination) { |
|
425 | 425 | $this->download($url, $destination); |
426 | 426 | |
427 | 427 | $file = basename($url); |
@@ -491,7 +491,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |