Completed
Pull Request — master (#110)
by Sang
05:54
created
src/package/Support/Collection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/package/Support/helpers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
      *
Please login to merge, or discard this patch.
src/update/Rinvex.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/update/Cities.php 1 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
         $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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/update/Currencies.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/update/Taxes.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/package/Data/Repository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
         $this->countriesJson = $this->loadCountriesJson();
110 110
 
111
-        $overload = $this->helper->loadJsonFiles($this->helper->dataDir('countries/overload'))->mapWithKeys(function ($country, $code) {
111
+        $overload = $this->helper->loadJsonFiles($this->helper->dataDir('countries/overload'))->mapWithKeys(function($country, $code) {
112 112
             return [upper($code) => $country];
113 113
         });
114 114
 
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function currencies()
163 163
     {
164
-        $currencies = $this->helper->loadJsonFiles($this->helper->dataDir('currencies/default'))->mapWithKeys(function ($country, $code) {
164
+        $currencies = $this->helper->loadJsonFiles($this->helper->dataDir('currencies/default'))->mapWithKeys(function($country, $code) {
165 165
             return [upper($code) => $country];
166 166
         });
167 167
 
168
-        $overload = $this->helper->loadJsonFiles($this->helper->dataDir('currencies/overload'))->mapWithKeys(function ($country, $code) {
168
+        $overload = $this->helper->loadJsonFiles($this->helper->dataDir('currencies/overload'))->mapWithKeys(function($country, $code) {
169 169
             return [upper($code) => $country];
170 170
         });
171 171
 
Please login to merge, or discard this patch.
src/package/Services/Helper.php 1 patch
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.
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.