Completed
Push — master ( b1076e...dd8ca6 )
by Antonio Carlos
06:19
created
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/package/Services/Config.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
src/package/Services/Countries.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 
3 3
 namespace PragmaRX\Countries\Package\Services;
4 4
 
5
-use PragmaRX\Countries\Update\Updater;
6 5
 use IlluminateAgnostic\Str\Support\Str;
7
-use PragmaRX\Countries\Package\Support\Base;
8 6
 use PragmaRX\Coollection\Package\Coollection;
9 7
 use PragmaRX\Countries\Package\Data\Repository;
10 8
 use PragmaRX\Countries\Package\Services\Cache\Service as Cache;
9
+use PragmaRX\Countries\Package\Support\Base;
10
+use PragmaRX\Countries\Update\Updater;
11 11
 
12 12
 class Countries extends Base
13 13
 {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/update/Rinvex.php 3 patches
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.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
      *
158 158
      * @param Coollection $natural
159 159
      * @param Coollection $rinvex
160
-     * @param $translation
160
+     * @param null|Coollection $translation
161 161
      * @param string $suffix
162 162
      * @return mixed|\PragmaRX\Coollection\Package\Coollection
163 163
      */
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/Services/Helper.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     /**
65 65
      * Load json files from dir.
66 66
      *
67
-     * @param $dir
67
+     * @param string $dir
68 68
      * @return \PragmaRX\Coollection\Package\Coollection
69 69
      */
70 70
     public function loadJsonFiles($dir)
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
     /**
108
-     * @param $contents
108
+     * @param string $contents
109 109
      * @return string
110 110
      */
111 111
     public function sanitizeFile($contents)
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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));
Please login to merge, or discard this patch.
src/update/Countries.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace PragmaRX\Countries\Update;
4 4
 
5
-use PragmaRX\Countries\Package\Support\Base;
6
-use PragmaRX\Countries\Package\Services\Config;
7 5
 use PragmaRX\Countries\Package\Countries as CountriesService;
8 6
 use PragmaRX\Countries\Package\Services\Cache\Service as Cache;
7
+use PragmaRX\Countries\Package\Services\Config;
8
+use PragmaRX\Countries\Package\Support\Base;
9 9
 
10 10
 class Countries extends Base
11 11
 {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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']);
Please login to merge, or discard this patch.