Completed
Branch master (c7f662)
by Antonio Carlos
02:01
created
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/Helper.php 3 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
262 262
     protected function renameMasterToPackage($file, $subPath, $path, $exclude): void
263 263
     {
264 264
         if (ends_with($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
 block discarded – undo
278 278
     {
279 279
         $path = dirname($file);
280 280
 
281
-        if (! ends_with($file, '.zip') || file_exists($subPath = "$path/$subPath")) {
281
+        if (!ends_with($file, '.zip') || file_exists($subPath = "$path/$subPath")) {
282 282
             return;
283 283
         }
284 284
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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[snake_case($key)] = arrayable($value) || is_array($value)
360 360
                 ? $this->arrayKeysSnakeRecursive($value)
361 361
                 : $value;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 ($path, $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 ($path, $destination) {
425 425
                     $this->download($url, $destination);
426 426
 
427 427
                     $file = basename($url);
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
      */
486 486
     public function loadJsonFiles($dir)
487 487
     {
488
-        return coollect(glob("$dir/*.json*"))->mapWithKeys(function ($file) {
488
+        return coollect(glob("$dir/*.json*"))->mapWithKeys(function($file) {
489 489
             $key = str_replace('.json', '', str_replace('.json5', '', basename($file)));
490 490
 
491 491
             return [$key => $this->loadJson($file)];
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
      */
519 519
     public function moveDataFiles()
520 520
     {
521
-        $this->config->get('moveable')->each(function ($to, $from) {
521
+        $this->config->get('moveable')->each(function($to, $from) {
522 522
             $this->moveDataFile($from, $to);
523 523
         });
524 524
     }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
      */
548 548
     public function message($message, $type = 'line')
549 549
     {
550
-        if (! is_null($this->command)) {
550
+        if (!is_null($this->command)) {
551 551
             $this->command->{$type}($message);
552 552
         }
553 553
     }
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
             $this->abort('loadCsv Error: File name not set');
578 578
         }
579 579
 
580
-        if (! file_exists($file)) {
580
+        if (!file_exists($file)) {
581 581
             $file = $this->dataDir($this->addSuffix('.csv', "/$dir/".strtolower($file)));
582 582
         }
583 583
 
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
      */
594 594
     public function makeJsonFileName($key, $dir = '')
595 595
     {
596
-        if (! ends_with($dir, (DIRECTORY_SEPARATOR))) {
596
+        if (!ends_with($dir, (DIRECTORY_SEPARATOR))) {
597 597
             $dir .= DIRECTORY_SEPARATOR;
598 598
         }
599 599
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
     {
675 675
         $this->progress('--- Delete temporary files');
676 676
 
677
-        $this->config->get('deletable')->each(function ($directory) {
677
+        $this->config->get('deletable')->each(function($directory) {
678 678
             if (file_exists($directory = $this->dataDir($directory))) {
679 679
                 $this->deleteDirectory($directory);
680 680
             }
Please login to merge, or discard this patch.
Doc Comments   +18 added lines, -13 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
     /**
71 71
      * Add suffix to string.
72 72
      *
73
-     * @param $suffix
74
-     * @param $string
75
-     * @return mixed
73
+     * @param string string
74
+     * @param string $string
75
+     * @return string
76 76
      */
77 77
     protected function addSuffix($suffix, $string)
78 78
     {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     /**
100 100
      * Delete a whole directory.
101 101
      *
102
-     * @param $dir
102
+     * @param string $dir
103 103
      */
104 104
     protected function deleteDirectory($dir)
105 105
     {
@@ -117,6 +117,11 @@  discard block
 block discarded – undo
117 117
         rmdir($dir);
118 118
     }
119 119
 
120
+    /**
121
+     * @param string $string
122
+     *
123
+     * @return resource
124
+     */
120 125
     protected function fopenOrFail($url, $string)
121 126
     {
122 127
         if (($handle = @fopen($url, $string)) === false) {
@@ -185,7 +190,7 @@  discard block
 block discarded – undo
185 190
 
186 191
     /**
187 192
      * @param $url
188
-     * @param $destination
193
+     * @param string $destination
189 194
      */
190 195
     public function downloadFile($url, $destination)
191 196
     {
@@ -256,8 +261,8 @@  discard block
 block discarded – undo
256 261
     /**
257 262
      * @param $file
258 263
      * @param $subPath
259
-     * @param $path
260
-     * @param $exclude
264
+     * @param string $path
265
+     * @param string $exclude
261 266
      */
262 267
     protected function renameMasterToPackage($file, $subPath, $path, $exclude): void
263 268
     {
@@ -311,8 +316,8 @@  discard block
 block discarded – undo
311 316
     /**
312 317
      * Load a shapeFile.
313 318
      *
314
-     * @param $dir
315
-     * @return \PragmaRX\Coollection\Package\Coollection
319
+     * @param string $dir
320
+     * @return string
316 321
      */
317 322
     public function shapeFile($dir)
318 323
     {
@@ -392,7 +397,7 @@  discard block
 block discarded – undo
392 397
      * Unzip a file.
393 398
      *
394 399
      * @param $file
395
-     * @param $path
400
+     * @param string $path
396 401
      */
397 402
     public function unzip($file, $path)
398 403
     {
@@ -480,7 +485,7 @@  discard block
 block discarded – undo
480 485
     /**
481 486
      * Load json files from dir.
482 487
      *
483
-     * @param $dir
488
+     * @param string $dir
484 489
      * @return \PragmaRX\Coollection\Package\Coollection
485 490
      */
486 491
     public function loadJsonFiles($dir)
@@ -566,7 +571,7 @@  discard block
 block discarded – undo
566 571
     /**
567 572
      * Loads a json file.
568 573
      *
569
-     * @param $file
574
+     * @param string $file
570 575
      * @param string $dir
571 576
      * @return \PragmaRX\Coollection\Package\Coollection
572 577
      * @throws \Exception
@@ -603,7 +608,7 @@  discard block
 block discarded – undo
603 608
     /**
604 609
      * Put contents into a file.
605 610
      *
606
-     * @param $file
611
+     * @param string $file
607 612
      * @param $contents
608 613
      */
609 614
     public function putFile($file, $contents)
Please login to merge, or discard this patch.
Unused Use Statements   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
3 3
 namespace PragmaRX\Countries\Update;
4 4
 
5 5
 use Exception;
6
-use ReflectionClass;
7
-use ShapeFile\ShapeFile;
8
-use RecursiveIteratorIterator;
9
-use RecursiveDirectoryIterator;
6
+use PragmaRX\Countries\Package\Contracts\Config as ConfigContract;
10 7
 use PragmaRX\Countries\Package\Services\Command;
11 8
 use PragmaRX\Countries\Package\Services\Helper as ServiceHelper;
12
-use PragmaRX\Countries\Package\Contracts\Config as ConfigContract;
9
+use RecursiveDirectoryIterator;
10
+use RecursiveIteratorIterator;
11
+use ReflectionClass;
12
+use ShapeFile\ShapeFile;
13 13
 
14 14
 class Helper
15 15
 {
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 3 patches
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.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
     /**
61 61
      * Repository constructor.
62 62
      *
63
-     * @param CacheContract $cache
63
+     * @param Cache $cache
64 64
      * @param Hydrator $hydrator
65 65
      * @param Helper $helper
66 66
      * @param Config $config
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace PragmaRX\Countries\Package\Data;
4 4
 
5
+use PragmaRX\Countries\Package\Contracts\Config;
5 6
 use PragmaRX\Countries\Package\Services\Cache;
6 7
 use PragmaRX\Countries\Package\Services\Helper;
7
-use PragmaRX\Countries\Package\Contracts\Config;
8 8
 use PragmaRX\Countries\Package\Services\Hydrator;
9 9
 use Psr\SimpleCache\CacheInterface as CacheContract;
10 10
 
Please login to merge, or discard this patch.
src/package/Services/Helper.php 2 patches
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.
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.
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.
src/package/Services/Cache.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      * Delete an item from the cache by its unique key.
120 120
      *
121 121
      * @param string $key
122
-     * @return bool
122
+     * @return boolean|null
123 123
      */
124 124
     public function delete($key)
125 125
     {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      * Get an item from the cache, or store the default value.
208 208
      *
209 209
      * @param  string $key
210
-     * @param  \DateTimeInterface|\DateInterval|float|int $minutes
210
+     * @param  integer $minutes
211 211
      * @param Closure $callback
212 212
      * @return mixed
213 213
      */
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 use Closure;
6 6
 use Exception;
7
-use Psr\SimpleCache\CacheInterface;
8 7
 use Nette\Caching\Cache as NetteCache;
9 8
 use Nette\Caching\Storages\FileStorage;
9
+use Psr\SimpleCache\CacheInterface;
10 10
 
11 11
 class Cache implements CacheInterface
12 12
 {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         if (is_null($this->dir)) {
56 56
             $this->dir = $this->config->cache->directory ?: sys_get_temp_dir().'/__PRAGMARX_COUNTRIES__/cache';
57 57
 
58
-            if (! file_exists($this->dir)) {
58
+            if (!file_exists($this->dir)) {
59 59
                 mkdir($this->dir, 0755, true);
60 60
             }
61 61
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function getMultiple($keys, $default = null)
145 145
     {
146
-        return coollect($keys)->map(function ($key) {
146
+        return coollect($keys)->map(function($key) {
147 147
             return $this->get($key);
148 148
         });
149 149
     }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function setMultiple($values, $ttl = null)
159 159
     {
160
-        return coollect($values)->map(function ($value, $key) use ($ttl) {
160
+        return coollect($values)->map(function($value, $key) use ($ttl) {
161 161
             return $this->set($key, $value, $ttl);
162 162
         });
163 163
     }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function deleteMultiple($keys)
172 172
     {
173
-        coollect($keys)->map(function ($key) {
173
+        coollect($keys)->map(function($key) {
174 174
             $this->forget($key);
175 175
         });
176 176
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function has($key)
185 185
     {
186
-        return ! is_null($this->get($key));
186
+        return !is_null($this->get($key));
187 187
     }
188 188
 
189 189
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     {
216 216
         $value = $this->get($key);
217 217
 
218
-        if (! is_null($value)) {
218
+        if (!is_null($value)) {
219 219
             return $value;
220 220
         }
221 221
 
Please login to merge, or discard this patch.
src/package/Services/Hydrator.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * Can hydrate?
58 58
      *
59 59
      * @param $element
60
-     * @param $enabled
60
+     * @param boolean $enabled
61 61
      * @param $countryCode
62 62
      * @return bool
63 63
      */
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      *
85 85
      * @param $countries
86 86
      * @param $elements
87
-     * @return mixed
87
+     * @return \PragmaRX\Countries\Package\Support\Collection
88 88
      */
89 89
     private function hydrateCountries($countries, $elements = null)
90 90
     {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      *
101 101
      * @param $country
102 102
      * @param $elements
103
-     * @return mixed
103
+     * @return \PragmaRX\Countries\Package\Support\Collection
104 104
      */
105 105
     private function hydrateCountry($country, $elements)
106 106
     {
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
      * Get country by country code.
382 382
      *
383 383
      * @param $countryCode
384
-     * @return mixed
384
+     * @return \PragmaRX\Countries\Package\Support\Collection
385 385
      */
386 386
     public function getCountry($countryCode)
387 387
     {
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
     /**
439 439
      * Repository setter.
440 440
      *
441
-     * @param $repository
441
+     * @param \PragmaRX\Countries\Package\Data\Repository $repository
442 442
      */
443 443
     public function setRepository($repository)
444 444
     {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
354 354
         $country = $this->fixCurrencies($country);
355 355
 
356 356
         if (isset($country['currencies'])) {
357
-            $currencies = countriesCollect($country['currencies'])->mapWithKeys(function ($code) {
357
+            $currencies = countriesCollect($country['currencies'])->mapWithKeys(function($code) {
358 358
                 if ($this->isCurrenciesArray($code)) {
359 359
                     return [
360 360
                         $code['ISO4217Code'] => $code,
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
      */
408 408
     public function addCountry($countryCode, $country)
409 409
     {
410
-        if (! isset($this->repository->countries[$countryCode])) {
410
+        if (!isset($this->repository->countries[$countryCode])) {
411 411
             $this->repository->countries[$countryCode] = $country;
412 412
         }
413 413
     }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
      */
435 435
     protected function checkHydrationElements($elements)
436 436
     {
437
-        $elements = countriesCollect($elements)->mapWithKeys(function ($value, $key) {
437
+        $elements = countriesCollect($elements)->mapWithKeys(function($value, $key) {
438 438
             if (is_numeric($key)) {
439 439
                 $key = $value;
440 440
                 $value = true;
Please login to merge, or discard this patch.
src/update/Updater.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     }
126 126
 
127 127
     /**
128
-     * @return mixed
128
+     * @return Command
129 129
      */
130 130
     public function getCommand()
131 131
     {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
     /**
207 207
      * @param $result
208
-     * @param $type
208
+     * @param string $type
209 209
      * @return \PragmaRX\Coollection\Package\Coollection
210 210
      */
211 211
     public function addRecordType($result, $type)
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      * @param \PragmaRX\Coollection\Package\Coollection $on
245 245
      * @param \PragmaRX\Coollection\Package\Coollection $by
246 246
      * @param $fields
247
-     * @param $codeField
247
+     * @param string $codeField
248 248
      * @return array
249 249
      */
250 250
     public function findByFields($on, $by, $fields, $codeField)
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     /**
325 325
      * @param $result
326 326
      * @param $dir
327
-     * @param $normalizerClosure
327
+     * @param Closure $normalizerClosure
328 328
      * @return array
329 329
      */
330 330
     public function normalizeData($result, $dir, $normalizerClosure)
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,13 +3,12 @@
 block discarded – undo
3 3
 namespace PragmaRX\Countries\Update;
4 4
 
5 5
 use Closure;
6
-use PragmaRX\Countries\Package\Support\Base;
7 6
 use PragmaRX\Coollection\Package\Coollection;
7
+use PragmaRX\Countries\Package\Contracts\Config as ConfigContract;
8 8
 use PragmaRX\Countries\Package\Services\Cache;
9
-use PragmaRX\Countries\Package\Contracts\Config;
10 9
 use PragmaRX\Countries\Package\Services\Command;
11 10
 use PragmaRX\Countries\Package\Services\Config as ConfigService;
12
-use PragmaRX\Countries\Package\Contracts\Config as ConfigContract;
11
+use PragmaRX\Countries\Package\Support\Base;
13 12
 
14 13
 /**
15 14
  * @codeCoverageIgnore
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
             $record = $record->toArray();
195 195
         }
196 196
 
197
-        if (! isset($record[$field = 'data_sources'])) {
197
+        if (!isset($record[$field = 'data_sources'])) {
198 198
             $record['data_sources'] = [];
199 199
         }
200 200
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     public function findByFields($on, $by, $fields, $codeField)
251 251
     {
252 252
         foreach ($fields as $field) {
253
-            if (isset($by[$field[1]]) && ! is_null($found = $on->where($field[0], $by[$field[1]])->first())) {
253
+            if (isset($by[$field[1]]) && !is_null($found = $on->where($field[0], $by[$field[1]])->first())) {
254 254
                 return [coollect($found), $found->{$codeField}];
255 255
             }
256 256
         }
@@ -268,19 +268,19 @@  discard block
 block discarded – undo
268 268
      */
269 269
     public function generateAllJsonFiles($dir, $makeGroupKeyClosure, $records, $groupKey)
270 270
     {
271
-        if (! empty($groupKey)) {
271
+        if (!empty($groupKey)) {
272 272
             $records = $records->groupBy($groupKey);
273 273
         }
274 274
 
275
-        $records->each(function (Coollection $record, $key) use ($dir, $makeGroupKeyClosure) {
275
+        $records->each(function(Coollection $record, $key) use ($dir, $makeGroupKeyClosure) {
276 276
             $this->helper->mkdir(dirname($file = $this->helper->makeJsonFileName($key, $dir)));
277 277
 
278
-            $record = $record->mapWithKeys(function ($record, $key) use ($makeGroupKeyClosure) {
278
+            $record = $record->mapWithKeys(function($record, $key) use ($makeGroupKeyClosure) {
279 279
                 $key = is_null($makeGroupKeyClosure)
280 280
                     ? $key
281 281
                     : $makeGroupKeyClosure($record, $key);
282 282
 
283
-                $record = coollect($record)->sortBy(function ($value, $key) {
283
+                $record = coollect($record)->sortBy(function($value, $key) {
284 284
                     return $key;
285 285
                 });
286 286
 
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 332
         return $this->cache->remember(
333 333
             'normalizeData'.$dir,
334 334
             160,
335
-            function () use ($dir, $result, $normalizerClosure) {
336
-                return coollect($result)->map(function ($item, $key) use ($normalizerClosure) {
337
-                    return $normalizerClosure(coollect($item)->mapWithKeys(function ($value, $key) {
335
+            function() use ($dir, $result, $normalizerClosure) {
336
+                return coollect($result)->map(function($item, $key) use ($normalizerClosure) {
337
+                    return $normalizerClosure(coollect($item)->mapWithKeys(function($value, $key) {
338 338
                         return [strtolower($key) => $value];
339 339
                     }), $key);
340 340
                 });
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
             $countryCode = $this->helper->caseForKey($item['name']);
364 364
         }
365 365
 
366
-        $item['iso_a3'] = ! isset($item['iso_a3'])
366
+        $item['iso_a3'] = !isset($item['iso_a3'])
367 367
             ? $countryCode
368 368
             : $item['iso_a3'];
369 369
 
Please login to merge, or discard this patch.