@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function arrayFinder(string $propertyName, $find, Closure $finderClosure) |
| 101 | 101 | { |
| 102 | - return $this->filter(function ($data) use ($find, $propertyName, $finderClosure) { |
|
| 102 | + return $this->filter(function($data) use ($find, $propertyName, $finderClosure) { |
|
| 103 | 103 | try { |
| 104 | 104 | $attributeValue = $data->{$propertyName}; |
| 105 | 105 | } catch (\Exception $e) { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | private function _whereKey(string $arrayName, $value) |
| 123 | 123 | { |
| 124 | - $finderClosure = function ($value, $attributeValue) { |
|
| 124 | + $finderClosure = function($value, $attributeValue) { |
|
| 125 | 125 | return Arr::has($attributeValue, $value); |
| 126 | 126 | }; |
| 127 | 127 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | private function _whereAttribute(string $arrayName, $value) |
| 139 | 139 | { |
| 140 | - $finderClosure = function ($value, $attributeValue) { |
|
| 140 | + $finderClosure = function($value, $attributeValue) { |
|
| 141 | 141 | return in_array($value, $attributeValue->toArray()); |
| 142 | 142 | }; |
| 143 | 143 | |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use PragmaRX\Countries\Package\Support\Collection; |
| 4 | 4 | |
| 5 | -if (! function_exists('array_sort_by_keys_recursive')) { |
|
| 5 | +if (!function_exists('array_sort_by_keys_recursive')) { |
|
| 6 | 6 | /** |
| 7 | 7 | * Recursively sort array by keys. |
| 8 | 8 | * |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -if (! function_exists('countriesCollect')) { |
|
| 24 | +if (!function_exists('countriesCollect')) { |
|
| 25 | 25 | /** |
| 26 | 26 | * Check if array is multidimensional. |
| 27 | 27 | * |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | -if (! function_exists('arrayable')) { |
|
| 37 | +if (!function_exists('arrayable')) { |
|
| 38 | 38 | /** |
| 39 | 39 | * Recursively change all array keys case. |
| 40 | 40 | * |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | /** |
| 17 | 17 | * Config constructor. |
| 18 | 18 | * |
| 19 | - * @param array|null $config |
|
| 19 | + * @param Helper $config |
|
| 20 | 20 | */ |
| 21 | 21 | public function __construct($config = null) |
| 22 | 22 | { |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * @param $key |
|
| 27 | + * @param string $key |
|
| 28 | 28 | * @return \PragmaRX\Coollection\Package\Coollection |
| 29 | 29 | */ |
| 30 | 30 | public function get($key) |
@@ -2,8 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace PragmaRX\Countries\Package\Services; |
| 4 | 4 | |
| 5 | -use PragmaRX\Countries\Package\Contracts\Config as ConfigContract; |
|
| 6 | - |
|
| 7 | 5 | class Config |
| 8 | 6 | { |
| 9 | 7 | /** |
@@ -235,7 +235,7 @@ |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | - * @param $repository |
|
| 238 | + * @param null|Repository $repository |
|
| 239 | 239 | * @return Repository |
| 240 | 240 | */ |
| 241 | 241 | protected function instantiateRepository($repository) |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace PragmaRX\Countries\Package\Services; |
| 4 | 4 | |
| 5 | -use PragmaRX\Countries\Update\Updater; |
|
| 6 | -use PragmaRX\Countries\Package\Support\Base; |
|
| 7 | 5 | use PragmaRX\Coollection\Package\Coollection; |
| 8 | 6 | use PragmaRX\Countries\Package\Data\Repository; |
| 7 | +use PragmaRX\Countries\Package\Support\Base; |
|
| 8 | +use PragmaRX\Countries\Update\Updater; |
|
| 9 | 9 | |
| 10 | 10 | class Countries extends Base |
| 11 | 11 | { |
@@ -102,14 +102,14 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $instance = $this; |
| 104 | 104 | |
| 105 | - Coollection::macro('hydrate', function ($elements = null) use ($instance) { |
|
| 105 | + Coollection::macro('hydrate', function($elements = null) use ($instance) { |
|
| 106 | 106 | return $instance->hydrate($this, $elements); |
| 107 | 107 | }); |
| 108 | 108 | |
| 109 | 109 | foreach (Hydrator::HYDRATORS as $hydrator) { |
| 110 | 110 | $hydrator = 'hydrate'.studly_case($hydrator); |
| 111 | 111 | |
| 112 | - Coollection::macro($hydrator, function () use ($hydrator, $instance) { |
|
| 112 | + Coollection::macro($hydrator, function() use ($hydrator, $instance) { |
|
| 113 | 113 | return $instance->getRepository()->getHydrator()->{$hydrator}($this); |
| 114 | 114 | }); |
| 115 | 115 | } |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | protected function instantiateCache(Cache $cache = null) |
| 177 | 177 | { |
| 178 | - if (is_null($this->cache) || ! is_null($cache)) { |
|
| 179 | - $this->cache = ! is_null($cache) |
|
| 178 | + if (is_null($this->cache) || !is_null($cache)) { |
|
| 179 | + $this->cache = !is_null($cache) |
|
| 180 | 180 | ? $cache |
| 181 | 181 | : new Cache($this->config); |
| 182 | 182 | } |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | protected function instantiateConfig($config = null) |
| 194 | 194 | { |
| 195 | - if (is_null($this->config) || ! is_null($config)) { |
|
| 196 | - $this->config = ! is_null($config) |
|
| 195 | + if (is_null($this->config) || !is_null($config)) { |
|
| 196 | + $this->config = !is_null($config) |
|
| 197 | 197 | ? $config |
| 198 | 198 | : new Config($this->helper); |
| 199 | 199 | } |
@@ -224,8 +224,8 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | protected function instantiateHydrator(Hydrator $hydrator = null) |
| 226 | 226 | { |
| 227 | - if (is_null($this->hydrator) || ! is_null($hydrator)) { |
|
| 228 | - $this->hydrator = ! is_null($hydrator) |
|
| 227 | + if (is_null($this->hydrator) || !is_null($hydrator)) { |
|
| 228 | + $this->hydrator = !is_null($hydrator) |
|
| 229 | 229 | ? $hydrator |
| 230 | 230 | : new Hydrator($this->config); |
| 231 | 231 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | 'latlng' => 'geo', |
| 62 | 62 | ]; |
| 63 | 63 | |
| 64 | - coollect($mergeable)->each(function ($to, $key) use (&$natural) { |
|
| 64 | + coollect($mergeable)->each(function($to, $key) use (&$natural) { |
|
| 65 | 65 | if (isset($natural[$key])) { |
| 66 | 66 | $natural->overwrite([$to => [$key => $natural[$key]]]); |
| 67 | 67 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function findRinvexState($country, $needle) |
| 115 | 115 | { |
| 116 | - $states = $this->findRinvex($country, 'divisions')->map(function ($state, $postal) { |
|
| 116 | + $states = $this->findRinvex($country, 'divisions')->map(function($state, $postal) { |
|
| 117 | 117 | $state['postal'] = $postal; |
| 118 | 118 | |
| 119 | 119 | $state['name'] = $this->helper->fixUtf8($state['name']); |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | return $states; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $state = $states->filter(function ($rinvexState) use ($needle) { |
|
| 128 | + $state = $states->filter(function($rinvexState) use ($needle) { |
|
| 129 | 129 | return $rinvexState->postal == $needle->postal || |
| 130 | 130 | $rinvexState->name == $needle['name'] || |
| 131 | 131 | utf8_encode($rinvexState->name) == $needle['name'] || |
| 132 | 132 | $rinvexState->alt_names->contains($needle['name']) || |
| 133 | - $rinvexState->alt_names->contains(function ($name) use ($needle) { |
|
| 133 | + $rinvexState->alt_names->contains(function($name) use ($needle) { |
|
| 134 | 134 | return $needle->alt_names->contains($name); |
| 135 | 135 | }); |
| 136 | 136 | })->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 | } |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | * Merge country data with Rinvex data. |
| 157 | 157 | * |
| 158 | 158 | * @param Coollection $natural |
| 159 | - * @param Coollection $rinvex |
|
| 160 | - * @param $translation |
|
| 159 | + * @param null|Coollection $rinvex |
|
| 160 | + * @param null|Coollection $translation |
|
| 161 | 161 | * @param string $suffix |
| 162 | 162 | * @return mixed|\PragmaRX\Coollection\Package\Coollection |
| 163 | 163 | */ |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
| 262 | - * @param \PragmaRX\Coollection\Package\Coollection $rinvex |
|
| 262 | + * @param null|Coollection $rinvex |
|
| 263 | 263 | * @param $cca3 |
| 264 | 264 | * @param $postal |
| 265 | 265 | * @param $country |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | namespace PragmaRX\Countries\Update; |
| 4 | 4 | |
| 5 | 5 | use Exception; |
| 6 | -use PragmaRX\Countries\Package\Support\Base; |
|
| 7 | 6 | use PragmaRX\Coollection\Package\Coollection; |
| 7 | +use PragmaRX\Countries\Package\Support\Base; |
|
| 8 | 8 | |
| 9 | 9 | class Rinvex extends Base |
| 10 | 10 | { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $this->helper->message('Processing states...'); |
| 53 | 53 | |
| 54 | - $normalizerClosure = function ($item) { |
|
| 54 | + $normalizerClosure = function($item) { |
|
| 55 | 55 | $item = $this->updater->addDataSource($item, 'natural'); |
| 56 | 56 | |
| 57 | 57 | $item = $this->updater->addRecordType($item, 'state'); |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | return $this->updater->normalizeStateOrCityData($item); |
| 60 | 60 | }; |
| 61 | 61 | |
| 62 | - $getCodeClosure = function ($item) { |
|
| 62 | + $getCodeClosure = function($item) { |
|
| 63 | 63 | return $this->makeStatePostalCode($item); |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | - $mergerClosure = function ($states) { |
|
| 66 | + $mergerClosure = function($states) { |
|
| 67 | 67 | return $this->rinvex->mergeCountryStatesWithRinvex($states); |
| 68 | 68 | }; |
| 69 | 69 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (! empty(trim($item->postal))) { |
|
| 93 | + if (!empty(trim($item->postal))) { |
|
| 94 | 94 | $item->postal; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -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); |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | $mledoze = $this->mledoze->loadMledozeCountries(); |
| 102 | 102 | |
| 103 | - $countries = coollect($this->helper->loadShapeFile('third-party/natural_earth/ne_10m_admin_0_countries'))->map(function ($country) { |
|
| 103 | + $countries = coollect($this->helper->loadShapeFile('third-party/natural_earth/ne_10m_admin_0_countries'))->map(function($country) { |
|
| 104 | 104 | return $this->natural->fixNaturalOddCountries($country); |
| 105 | - })->mapWithKeys(function ($natural) use ($mledoze, $dataDir) { |
|
| 105 | + })->mapWithKeys(function($natural) use ($mledoze, $dataDir) { |
|
| 106 | 106 | list($mledoze, $countryCode) = $this->mledoze->findMledozeCountry($mledoze, $natural); |
| 107 | 107 | |
| 108 | - $natural = coollect($natural)->mapWithKeys(function ($country, $key) { |
|
| 108 | + $natural = coollect($natural)->mapWithKeys(function($country, $key) { |
|
| 109 | 109 | return [strtolower($key) => $country]; |
| 110 | 110 | }); |
| 111 | 111 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | public function clearCountryCurrencies($country) |
| 145 | 145 | { |
| 146 | - if (isset($country['currency']) && ! is_null($country['currency'])) { |
|
| 146 | + if (isset($country['currency']) && !is_null($country['currency'])) { |
|
| 147 | 147 | $country['currencies'] = array_keys($country['currency']); |
| 148 | 148 | |
| 149 | 149 | unset($country['currency']); |
@@ -83,7 +83,7 @@ |
||
| 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) |
@@ -2,10 +2,10 @@ |
||
| 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 | { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function loadMledozeCountries() |
| 46 | 46 | { |
| 47 | - $mledoze = coollect($this->helper->loadJson('countries', 'third-party/mledoze/dist'))->mapWithKeys(function ( |
|
| 47 | + $mledoze = coollect($this->helper->loadJson('countries', 'third-party/mledoze/dist'))->mapWithKeys(function( |
|
| 48 | 48 | $country |
| 49 | 49 | ) { |
| 50 | 50 | $country = $this->updater->addDataSource($country, 'mledoze'); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | list($country, $countryCode) = $this->updater->findCountryByAnyField($mledoze, $natural); |
| 100 | 100 | |
| 101 | - if (! $country->isEmpty()) { |
|
| 101 | + if (!$country->isEmpty()) { |
|
| 102 | 102 | return [coollect($this->helper->arrayKeysSnakeRecursive($country)), $countryCode]; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $result[$key] = $mledozeValue; // Natural Earth Vector |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - return coollect($result)->sortBy(function ($value, $key) { |
|
| 149 | + return coollect($result)->sortBy(function($value, $key) { |
|
| 150 | 150 | return $key; |
| 151 | 151 | }); |
| 152 | 152 | } |
@@ -2,8 +2,8 @@ |
||
| 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 | { |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | }) |
| 102 | 102 | ->mapWithKeys(function ($item, $cca2) { |
| 103 | 103 | $fields = [ |
| 104 | - ['cca2', 'cca2'], |
|
| 105 | - ['name.common', 'name'], |
|
| 106 | - ['name.official', 'name'], |
|
| 104 | + ['cca2', 'cca2'], |
|
| 105 | + ['name.common', 'name'], |
|
| 106 | + ['name.official', 'name'], |
|
| 107 | 107 | ]; |
| 108 | 108 | |
| 109 | 109 | list($country) = $this->updater->findByFields($this->updater->getCountries(), $item, $fields, 'cca2'); |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | return [ |
| 116 | - $country->cca3 => [ |
|
| 117 | - 'cca2' => $country->cca2, |
|
| 118 | - 'cca3' => $country->cca3, |
|
| 119 | - 'name' => $item['name'], |
|
| 120 | - ], |
|
| 116 | + $country->cca3 => [ |
|
| 117 | + 'cca2' => $country->cca2, |
|
| 118 | + 'cca3' => $country->cca3, |
|
| 119 | + 'name' => $item['name'], |
|
| 120 | + ], |
|
| 121 | 121 | ]; |
| 122 | 122 | })->map(function ($country) use ($zones, $abbreviations) { |
| 123 | 123 | $country['timezones'] = $zones->where('country_code', $country['cca2'])->mapWithKeys(function ($zone) use ($abbreviations, $country) { |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace PragmaRX\Countries\Update; |
| 4 | 4 | |
| 5 | -use PragmaRX\Countries\Package\Support\Base; |
|
| 6 | 5 | use PragmaRX\Coollection\Package\Coollection; |
| 7 | 6 | use PragmaRX\Countries\Package\Services\Cache; |
| 8 | 7 | use PragmaRX\Countries\Package\Services\Config; |
| 8 | +use PragmaRX\Countries\Package\Support\Base; |
|
| 9 | 9 | |
| 10 | 10 | class Timezones extends Base |
| 11 | 11 | { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $countries = $this->cache->remember( |
| 51 | 51 | 'updateTimezone.countries', |
| 52 | 52 | 160, |
| 53 | - function () { |
|
| 53 | + function() { |
|
| 54 | 54 | return $this->helper->loadCsv($this->helper->dataDir('third-party/timezonedb/country.csv')); |
| 55 | 55 | } |
| 56 | 56 | ); |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | $zones = $this->cache->remember( |
| 61 | 61 | 'updateTimezone.zones', |
| 62 | 62 | 160, |
| 63 | - function () { |
|
| 64 | - return $this->helper->loadCsv($this->helper->dataDir('third-party/timezonedb/zone.csv'))->mapWithKeys(function ($value) { |
|
| 63 | + function() { |
|
| 64 | + return $this->helper->loadCsv($this->helper->dataDir('third-party/timezonedb/zone.csv'))->mapWithKeys(function($value) { |
|
| 65 | 65 | return [ |
| 66 | 66 | $value[0] => [ |
| 67 | 67 | 'zone_id' => $value[0], |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | $timezones = $this->cache->remember( |
| 79 | 79 | 'updateTimezone.timezones', |
| 80 | 80 | 160, |
| 81 | - function () { |
|
| 82 | - return $this->helper->loadCsv($this->helper->dataDir('third-party/timezonedb/timezone.csv'))->map(function ($timezone) { |
|
| 81 | + function() { |
|
| 82 | + return $this->helper->loadCsv($this->helper->dataDir('third-party/timezonedb/timezone.csv'))->map(function($timezone) { |
|
| 83 | 83 | return [ |
| 84 | 84 | 'zone_id' => $timezone[0], |
| 85 | 85 | 'abbreviation' => $timezone[1], |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | $abbreviations = $this->cache->remember( |
| 97 | 97 | 'updateTimezone.abbreviations', |
| 98 | 98 | 160, |
| 99 | - function () use ($timezones) { |
|
| 100 | - return $timezones->groupBy('zone_id')->map(function (Coollection $timezones) { |
|
| 101 | - return $timezones->map(function ($timezone) { |
|
| 99 | + function() use ($timezones) { |
|
| 100 | + return $timezones->groupBy('zone_id')->map(function(Coollection $timezones) { |
|
| 101 | + return $timezones->map(function($timezone) { |
|
| 102 | 102 | return $timezone['abbreviation']; |
| 103 | 103 | })->unique()->sort()->values(); |
| 104 | 104 | }); |
@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $this->helper->progress('Updating countries timezones...'); |
| 109 | 109 | |
| 110 | - $countries = $countries->mapWithKeys(function ($item) { |
|
| 110 | + $countries = $countries->mapWithKeys(function($item) { |
|
| 111 | 111 | return [$item[0] => [ |
| 112 | 112 | 'cca2' => $item[0], |
| 113 | 113 | 'name' => $item[1], |
| 114 | 114 | ]]; |
| 115 | 115 | }) |
| 116 | - ->mapWithKeys(function ($item, $cca2) { |
|
| 116 | + ->mapWithKeys(function($item, $cca2) { |
|
| 117 | 117 | $fields = [ |
| 118 | 118 | ['cca2', 'cca2'], |
| 119 | 119 | ['name.common', 'name'], |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | 'name' => $item['name'], |
| 134 | 134 | ], |
| 135 | 135 | ]; |
| 136 | - })->map(function ($country) use ($zones, $abbreviations) { |
|
| 137 | - $country['timezones'] = $zones->where('country_code', $country['cca2'])->mapWithKeys(function ($zone) use ($abbreviations, $country) { |
|
| 136 | + })->map(function($country) use ($zones, $abbreviations) { |
|
| 137 | + $country['timezones'] = $zones->where('country_code', $country['cca2'])->mapWithKeys(function($zone) use ($abbreviations, $country) { |
|
| 138 | 138 | $zone['abbreviations'] = $abbreviations[$zone['zone_id']]; |
| 139 | 139 | |
| 140 | 140 | $zone['cca3'] = isset($country['cca3']) ? $country['cca3'] : null; |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $this->helper->message('Generating timezone files...'); |
| 155 | 155 | |
| 156 | - $getCountryCodeClosure = function () { |
|
| 156 | + $getCountryCodeClosure = function() { |
|
| 157 | 157 | }; |
| 158 | 158 | |
| 159 | - $normalizeCountryClosure = function ($country) { |
|
| 159 | + $normalizeCountryClosure = function($country) { |
|
| 160 | 160 | return [$country['timezones']]; |
| 161 | 161 | }; |
| 162 | 162 | |
| 163 | - $dummyClosure = function ($country) { |
|
| 163 | + $dummyClosure = function($country) { |
|
| 164 | 164 | return $country; |
| 165 | 165 | }; |
| 166 | 166 | |