Completed
Push — master ( f2ed00...07b62e )
by Antonio Carlos
05:36
created
src/package/Data/Repository.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * @param CacheContract $cache
64 64
      * @param Hydrator $hydrator
65 65
      * @param Helper $helper
66
-     * @param object $config
66
+     * @param \PragmaRX\Countries\Package\Services\Config $config
67 67
      */
68 68
     public function __construct(CacheContract $cache, Hydrator $hydrator, Helper $helper, $config)
69 69
     {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      * Load currency json file.
180 180
      *
181 181
      * @param $code
182
-     * @return string
182
+     * @return \PragmaRX\Coollection\Package\Coollection
183 183
      */
184 184
     public function loadCurrenciesForCountry($code)
185 185
     {
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      * Find a country timezone.
312 312
      *
313 313
      * @param $countryCode
314
-     * @return null
314
+     * @return \PragmaRX\Coollection\Package\Coollection
315 315
      */
316 316
     public function findTimezones($countryCode)
317 317
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use PragmaRX\Countries\Package\Services\Cache;
6 6
 use PragmaRX\Countries\Package\Services\Helper;
7
-use PragmaRX\Countries\Package\Contracts\Config;
8 7
 use PragmaRX\Countries\Package\Services\Hydrator;
9 8
 use Psr\SimpleCache\CacheInterface as CacheContract;
10 9
 
Please login to merge, or discard this patch.
src/package/Services/Cache.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     /**
72 72
      * Check if cache is enabled.
73 73
      *
74
-     * @return bool
74
+     * @return \PragmaRX\Coollection\Package\Coollection
75 75
      */
76 76
     protected function enabled()
77 77
     {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      * Delete an item from the cache by its unique key.
133 133
      *
134 134
      * @param string $key
135
-     * @return bool
135
+     * @return boolean|null
136 136
      */
137 137
     public function delete($key)
138 138
     {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      * Get an item from the cache, or store the default value.
198 198
      *
199 199
      * @param  string $key
200
-     * @param  \DateTimeInterface|\DateInterval|float|int $minutes
200
+     * @param  integer $minutes
201 201
      * @param Closure $callback
202 202
      * @return mixed
203 203
      */
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\Package\Services;
4 4
 
5 5
 use Closure;
6
-use Psr\SimpleCache\CacheInterface;
7 6
 use PragmaRX\Countries\Package\Services\Cache\Managers\Nette as NetteManager;
7
+use Psr\SimpleCache\CacheInterface;
8 8
 
9 9
 class Cache implements CacheInterface
10 10
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@
 block discarded – undo
203 203
      */
204 204
     public function remember($key, $minutes, Closure $callback)
205 205
     {
206
-        if (! is_null($value = $this->manager->get($key))) {
206
+        if (!is_null($value = $this->manager->get($key))) {
207 207
             return $value;
208 208
         }
209 209
 
Please login to merge, or discard this patch.
src/package/Services/Cache/Managers/Nette.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     /**
50 50
      * Check if cache is enabled.
51 51
      *
52
-     * @return bool
52
+     * @return \PragmaRX\Coollection\Package\Coollection
53 53
      */
54 54
     protected function enabled()
55 55
     {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      * Delete an item from the cache by its unique key.
136 136
      *
137 137
      * @param string $key
138
-     * @return bool
138
+     * @return boolean|null
139 139
      */
140 140
     public function delete($key)
141 141
     {
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,11 +3,10 @@
 block discarded – undo
3 3
 namespace PragmaRX\Countries\Package\Services\Cache\Managers;
4 4
 
5 5
 use Closure;
6
-use Exception;
7
-use Psr\SimpleCache\CacheInterface;
8 6
 use Nette\Caching\Cache as NetteCache;
9 7
 use Nette\Caching\Storages\FileStorage;
10 8
 use PragmaRX\Countries\Package\Services\Config;
9
+use Psr\SimpleCache\CacheInterface;
11 10
 
12 11
 class Nette implements CacheInterface
13 12
 {
Please login to merge, or discard this patch.
src/package/Services/Helper.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * Rinvex constructor.
16 16
      *
17
-     * @param object $config
17
+     * @param Config $config
18 18
      */
19 19
     public function __construct($config)
20 20
     {
@@ -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.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace PragmaRX\Countries\Package\Services;
4 4
 
5
-use PragmaRX\Countries\Package\Contracts\Config;
6
-
7 5
 class Helper
8 6
 {
9 7
     /**
Please login to merge, or discard this patch.
src/package/Services/Hydrator.php 2 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     /**
47 47
      * Hydrator constructor.
48 48
      *
49
-     * @param object $config
49
+     * @param Config $config
50 50
      */
51 51
     public function __construct($config)
52 52
     {
@@ -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
      */
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      *
94 94
      * @param $countries
95 95
      * @param $elements
96
-     * @return mixed
96
+     * @return \PragmaRX\Countries\Package\Support\Collection
97 97
      */
98 98
     private function hydrateCountries($countries, $elements = null)
99 99
     {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *
110 110
      * @param $country
111 111
      * @param $elements
112
-     * @return mixed
112
+     * @return \PragmaRX\Countries\Package\Support\Collection
113 113
      */
114 114
     private function hydrateCountry($country, $elements)
115 115
     {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      * Hydrate flag.
286 286
      *
287 287
      * @param $country
288
-     * @return mixed
288
+     * @return Coollection
289 289
      */
290 290
     public function hydrateFlag($country)
291 291
     {
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
      * Get country by country code.
397 397
      *
398 398
      * @param $countryCode
399
-     * @return mixed
399
+     * @return \PragmaRX\Countries\Package\Support\Collection
400 400
      */
401 401
     public function getCountry($countryCode)
402 402
     {
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     /**
456 456
      * Repository setter.
457 457
      *
458
-     * @param $repository
458
+     * @param \PragmaRX\Countries\Package\Data\Repository $repository
459 459
      */
460 460
     public function setRepository($repository)
461 461
     {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 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,
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      */
412 412
     public function addCountry($countryCode, $country)
413 413
     {
414
-        if (! isset($this->repository->countries[$countryCode])) {
414
+        if (!isset($this->repository->countries[$countryCode])) {
415 415
             $this->repository->countries[$countryCode] = $country;
416 416
         }
417 417
     }
@@ -438,14 +438,14 @@  discard block
 block discarded – undo
438 438
      */
439 439
     protected function checkHydrationElements($elements)
440 440
     {
441
-        $elements = countriesCollect($elements)->mapWithKeys(function ($value, $key) {
441
+        $elements = countriesCollect($elements)->mapWithKeys(function($value, $key) {
442 442
             if (is_numeric($key)) {
443 443
                 $key = $value;
444 444
                 $value = true;
445 445
             }
446 446
 
447 447
             return [$key => $value];
448
-        })->filter(function ($element) {
448
+        })->filter(function($element) {
449 449
             return $element;
450 450
         });
451 451
 
Please login to merge, or discard this patch.
src/package/Services/Countries.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.