@@ -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 | * |
@@ -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 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $this->helper->message('Processing cities...'); |
45 | 45 | |
46 | - $normalizerClosure = function ($item) { |
|
46 | + $normalizerClosure = function($item) { |
|
47 | 47 | $item = $this->updater->addDataSource($item, 'natural'); |
48 | 48 | |
49 | 49 | $item = $this->updater->addRecordType($item, 'city'); |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | return $this->updater->normalizeStateOrCityData($item); |
52 | 52 | }; |
53 | 53 | |
54 | - $codeGeneratorClosure = function ($item) { |
|
54 | + $codeGeneratorClosure = function($item) { |
|
55 | 55 | return $this->helper->caseForKey($item['nameascii']); |
56 | 56 | }; |
57 | 57 | |
58 | - $mergerClosure = function ($item) { |
|
58 | + $mergerClosure = function($item) { |
|
59 | 59 | return $item; |
60 | 60 | }; |
61 | 61 |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | throw new Exception("No currencies found in {$directory}"); |
48 | 48 | } |
49 | 49 | |
50 | - $currencies = $currencies->mapWithKeys(function ($currency) { |
|
50 | + $currencies = $currencies->mapWithKeys(function($currency) { |
|
51 | 51 | return $currency; |
52 | 52 | }); |
53 | 53 | |
54 | 54 | $this->helper->message('Processing currencies...'); |
55 | 55 | |
56 | - $normalizerClosure = function ($item) { |
|
56 | + $normalizerClosure = function($item) { |
|
57 | 57 | $item = $this->updater->addDataSource($item, 'world-currencies'); |
58 | 58 | |
59 | 59 | $item = $this->updater->addRecordType($item, 'currency'); |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | return [$item]; |
62 | 62 | }; |
63 | 63 | |
64 | - $getCodeClosure = function () { |
|
64 | + $getCodeClosure = function() { |
|
65 | 65 | }; |
66 | 66 | |
67 | - $generateTaxData = function ($tax) { |
|
67 | + $generateTaxData = function($tax) { |
|
68 | 68 | return $tax; |
69 | 69 | }; |
70 | 70 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | $taxes = $this->helper->loadJsonFiles($this->helper->dataDir('third-party/commerceguys/taxes/types')); |
40 | 40 | |
41 | - $taxes = $taxes->mapWithKeys(function ($vat, $key) { |
|
41 | + $taxes = $taxes->mapWithKeys(function($vat, $key) { |
|
42 | 42 | $parts = coollect(explode('_', $key)); |
43 | 43 | $cca2 = $parts->first(); |
44 | 44 | $type = $parts->last(); |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | $this->helper->message('Processing taxes...'); |
71 | 71 | |
72 | - $normalizerClosure = function ($item) { |
|
72 | + $normalizerClosure = function($item) { |
|
73 | 73 | return $item; |
74 | 74 | }; |
75 | 75 | |
76 | - $getCodeClosure = function ($item) { |
|
76 | + $getCodeClosure = function($item) { |
|
77 | 77 | return $item['tax_type']; |
78 | 78 | }; |
79 | 79 | |
80 | - $generateTaxData = function ($tax) { |
|
80 | + $generateTaxData = function($tax) { |
|
81 | 81 | return $this->normalizeTax($tax); |
82 | 82 | }; |
83 | 83 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $this->helper->message('Processing states...'); |
50 | 50 | |
51 | - $normalizerClosure = function ($item) { |
|
51 | + $normalizerClosure = function($item) { |
|
52 | 52 | $item = $this->updater->addDataSource($item, 'natural'); |
53 | 53 | |
54 | 54 | $item = $this->updater->addRecordType($item, 'state'); |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | return $this->updater->normalizeStateOrCityData($item); |
57 | 57 | }; |
58 | 58 | |
59 | - $getCodeClosure = function ($item) { |
|
59 | + $getCodeClosure = function($item) { |
|
60 | 60 | return $this->makeStatePostalCode($item); |
61 | 61 | }; |
62 | 62 | |
63 | 63 | $counter = 0; |
64 | 64 | |
65 | - $mergerClosure = function ($states) use (&$counter) { |
|
65 | + $mergerClosure = function($states) use (&$counter) { |
|
66 | 66 | if ($counter++ % 100 === 0) { |
67 | 67 | $this->helper->message("Processed: $counter"); |
68 | 68 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - if (! empty(trim($item->postal))) { |
|
96 | + if (!empty(trim($item->postal))) { |
|
97 | 97 | $item->postal; |
98 | 98 | } |
99 | 99 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | private function arrayFinder(string $propertyName, $find, Closure $finderClosure) |
110 | 110 | { |
111 | - return $this->filter(function ($data) use ($find, $propertyName, $finderClosure) { |
|
111 | + return $this->filter(function($data) use ($find, $propertyName, $finderClosure) { |
|
112 | 112 | try { |
113 | 113 | $attributeValue = $data->{$propertyName}; |
114 | 114 | } catch (\Exception $e) { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | private function _whereKey(string $arrayName, $value) |
132 | 132 | { |
133 | - $finderClosure = function ($value, $attributeValue) { |
|
133 | + $finderClosure = function($value, $attributeValue) { |
|
134 | 134 | return Arr::has($attributeValue, $value); |
135 | 135 | }; |
136 | 136 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | private function _whereAttribute(string $arrayName, $value) |
150 | 150 | { |
151 | - $finderClosure = function ($value, $attributeValue) { |
|
151 | + $finderClosure = function($value, $attributeValue) { |
|
152 | 152 | return \in_array($value, $attributeValue->toArray()); |
153 | 153 | }; |
154 | 154 |
@@ -6,7 +6,7 @@ |
||
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( |
@@ -202,7 +202,7 @@ |
||
202 | 202 | */ |
203 | 203 | public function remember($key, $minutes, Closure $callback) |
204 | 204 | { |
205 | - if (! \is_null($value = $this->manager->get($key))) { |
|
205 | + if (!\is_null($value = $this->manager->get($key))) { |
|
206 | 206 | return $value; |
207 | 207 | } |
208 | 208 |