Passed
Push — master ( 0fe7ef...b6c3d8 )
by F
02:48
created
src/Middleware/Locale.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      *
24 24
      * @return mixed
25 25
      */
26
-    public function handle(Request $request, Closure $next)
26
+    public function handle (Request $request, Closure $next)
27 27
     {
28 28
         $session = $request->getSession();
29 29
 
Please login to merge, or discard this patch.
src/Exceptions/AddressDoesNotExist.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @return static
25 25
      */
26
-    public static function create(string $addressName)
26
+    public static function create (string $addressName)
27 27
     {
28 28
         return new static("There is no address named `{$addressName}`.");
29 29
     }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      *
36 36
      * @return static
37 37
      */
38
-    public static function withId(int $addressId)
38
+    public static function withId (int $addressId)
39 39
     {
40 40
         return new static("There is no [address] with id `{$addressId}`.");
41 41
     }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      *
48 48
      * @return static
49 49
      */
50
-    public static function withType(string $addressType)
50
+    public static function withType (string $addressType)
51 51
     {
52 52
         return new static("There is no [address] with type `{$addressType}`.");
53 53
     }
Please login to merge, or discard this patch.
src/Models/Currency.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      *
32 32
      * @param array $attributes additional attributes for model initialisation
33 33
      */
34
-    public function __construct(array $attributes = [])
34
+    public function __construct (array $attributes = [])
35 35
     {
36 36
         parent::__construct($attributes);
37 37
 
Please login to merge, or discard this patch.
src/Models/Language.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      *
29 29
      * @return void
30 30
      */
31
-    public function __construct(array $attributes = [])
31
+    public function __construct (array $attributes = [])
32 32
     {
33 33
         parent::__construct($attributes);
34 34
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      *
41 41
      * @return BelongsToMany countries the language belongs to
42 42
      */
43
-    public function countries(): BelongsToMany
43
+    public function countries (): BelongsToMany
44 44
     {
45 45
         return $this->belongsToMany(
46 46
             config('pwweb.localisation.models.countries'),
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      *
60 60
      * @return \PWWEB\Localisation\Contracts\Language
61 61
      */
62
-    public static function findByName(string $name): LanguageContract
62
+    public static function findByName (string $name): LanguageContract
63 63
     {
64 64
         $language = static::getLanguages(['name' => $name])->first();
65 65
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @return \PWWEB\Localisation\Contracts\Language
81 81
      */
82
-    public static function findById(int $id): LanguageContract
82
+    public static function findById (int $id): LanguageContract
83 83
     {
84 84
         $language = static::getLanguages(['id' => $id])->first();
85 85
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      *
100 100
      * @return \PWWEB\Localisation\Contracts\Language
101 101
      */
102
-    public static function findByLocale(string $locale): LanguageContract
102
+    public static function findByLocale (string $locale): LanguageContract
103 103
     {
104 104
         $language = static::getLanguages(['locale' => $locale])->first();
105 105
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      *
118 118
      * @return Collection collection of languages
119 119
      */
120
-    protected static function getLanguages(array $params = []): Collection
120
+    protected static function getLanguages (array $params = []): Collection
121 121
     {
122 122
         return app(LocalisationRegistrar::class)
123 123
             ->setLanguageClass(static::class)
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      *
132 132
      * @return array
133 133
      */
134
-    protected static function getLocales(array $params = []): array
134
+    protected static function getLocales (array $params = []): array
135 135
     {
136 136
         $locales = [];
137 137
         $languages = self::getLanguages($params);
Please login to merge, or discard this patch.
src/Controllers/LanguageController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      *
16 16
      * @return \Illuminate\Http\RedirectResponse
17 17
      */
18
-    public function switch($locale)
18
+    public function switch ($locale)
19 19
     {
20 20
         $locales = (array) Language::getLocales();
21 21
 
Please login to merge, or discard this patch.
src/Traits/HasAddresses.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      *
31 31
      * @return string
32 32
      */
33
-    public function getAddressClass(): string
33
+    public function getAddressClass (): string
34 34
     {
35 35
         if (false === isset($this->addressClass)) {
36 36
             $this->addressClass = app(LocalisationRegistrar::class)->getAddressClass();
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      *
45 45
      * @return \Illuminate\Database\Eloquent\Relations\MorphToMany
46 46
      */
47
-    public function addresses(): MorphToMany
47
+    public function addresses (): MorphToMany
48 48
     {
49 49
         return $this->morphToMany(
50 50
             config('pwweb.localisation.models.address'),
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
      *
63 63
      * @return mixed
64 64
      */
65
-    public function assignAddress(...$addresses)
65
+    public function assignAddress (...$addresses)
66 66
     {
67 67
         $addresses = collect($addresses)
68 68
             ->flatten()
69 69
             ->map(
70
-                function ($address) {
70
+                function($address) {
71 71
                     if (true === empty($address)) {
72 72
                         return false;
73 73
                     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                 }
77 77
             )
78 78
             ->filter(
79
-                function ($address) {
79
+                function($address) {
80 80
                     return $address instanceof Address;
81 81
                 }
82 82
             )
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             $class = \get_class($model);
93 93
 
94 94
             $class::saved(
95
-                function ($object) use ($addresses, $model) {
95
+                function($object) use ($addresses, $model) {
96 96
                     static $modelLastFiredOn;
97 97
                     if (null !== $modelLastFiredOn && $modelLastFiredOn === $model) {
98 98
                         return;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      *
117 117
      * @return \PWWEB\Localisation\Contracts\Address
118 118
      */
119
-    protected function getStoredAddress($address): Address
119
+    protected function getStoredAddress ($address): Address
120 120
     {
121 121
         $addressClass = $this->getAddressClass();
122 122
 
Please login to merge, or discard this patch.
src/LocalisationRegistrar.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      *
118 118
      * @param \Illuminate\Cache\CacheManager $cacheManager The cache manager object
119 119
      */
120
-    public function __construct(CacheManager $cacheManager)
120
+    public function __construct (CacheManager $cacheManager)
121 121
     {
122 122
         $this->addressClass = config('pwweb.localisation.models.address');
123 123
         $this->addressTypeClass = config('pwweb.localisation.models.address_type');
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      *
135 135
      * @return void
136 136
      */
137
-    protected function initializeCache()
137
+    protected function initializeCache ()
138 138
     {
139 139
         self::$cacheExpirationTime = config('pwweb.localisation.cache.expiration_time', config('pwweb.localisation.cache_expiration_time'));
140 140
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      *
150 150
      * @return Repository Cache store
151 151
      */
152
-    protected function getCacheStoreFromConfig(): Repository
152
+    protected function getCacheStoreFromConfig (): Repository
153 153
     {
154 154
         // the 'default' fallback here is from the localisation.php config file, where 'default' means to use config(cache.default)
155 155
         $cacheDriver = config('pwweb.localisation.cache.store', 'default');
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      *
173 173
      * @return bool
174 174
      */
175
-    public function registerLanguages(): bool
175
+    public function registerLanguages (): bool
176 176
     {
177 177
         return true;
178 178
     }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      *
183 183
      * @return bool
184 184
      */
185
-    public function forgetCachedAddresses()
185
+    public function forgetCachedAddresses ()
186 186
     {
187 187
         $this->addresses = null;
188 188
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      *
195 195
      * @return bool
196 196
      */
197
-    public function forgetCachedLanguages()
197
+    public function forgetCachedLanguages ()
198 198
     {
199 199
         $this->languages = null;
200 200
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      *
209 209
      * @return void
210 210
      */
211
-    public function clearClassLanguages()
211
+    public function clearClassLanguages ()
212 212
     {
213 213
         $this->languages = null;
214 214
     }
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
      *
221 221
      * @return \Illuminate\Support\Collection
222 222
      */
223
-    public function getAddresses(array $params = []): Collection
223
+    public function getAddresses (array $params = []): Collection
224 224
     {
225 225
         if (null === $this->addresses) {
226 226
             $this->addresses = $this->cache->remember(
227
-                self::$cacheKey . '.addresses',
227
+                self::$cacheKey.'.addresses',
228 228
                 self::$cacheExpirationTime,
229
-                function () {
229
+                function() {
230 230
                     return $this->getAddressModel()
231 231
                         //->with('system_address_types')
232 232
                         ->get();
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
      *
252 252
      * @return \Illuminate\Support\Collection
253 253
      */
254
-    public function getLanguages(array $params = []): Collection
254
+    public function getLanguages (array $params = []): Collection
255 255
     {
256 256
         if (null === $this->languages) {
257 257
             $this->languages = $this->cache->remember(
258 258
                 self::$cacheKey,
259 259
                 self::$cacheExpirationTime,
260
-                function () {
260
+                function() {
261 261
                     return $this->getLanguageClass()
262 262
                     //->with('countries')
263 263
                         ->get();
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      *
280 280
      * @return PWWEB\Localisation\Contract\Address
281 281
      */
282
-    public function getAddressModel(): Address
282
+    public function getAddressModel (): Address
283 283
     {
284 284
         return app($this->addressClass);
285 285
     }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      *
290 290
      * @return PWWEB\Localisation\Contract\Address\Type
291 291
      */
292
-    public function getAddressTypeClass(): AddressType
292
+    public function getAddressTypeClass (): AddressType
293 293
     {
294 294
         return app($this->addressTypeClass);
295 295
     }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      *
300 300
      * @return PWWEB\Localisation\Contract\Country
301 301
      */
302
-    public function getCountryClass(): Country
302
+    public function getCountryClass (): Country
303 303
     {
304 304
         return app($this->countryClass);
305 305
     }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      *
310 310
      * @return PWWEB\Localisation\Contract\Currency
311 311
      */
312
-    public function getCurrencyClass(): Currency
312
+    public function getCurrencyClass (): Currency
313 313
     {
314 314
         return app($this->currencyClass);
315 315
     }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      *
320 320
      * @return PWWEB\Localisation\Contract\Language
321 321
      */
322
-    public function getLanguageClass(): Language
322
+    public function getLanguageClass (): Language
323 323
     {
324 324
         return app($this->languageClass);
325 325
     }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
      *
332 332
      * @return object
333 333
      */
334
-    public function setAddressClass(string $addressClass)
334
+    public function setAddressClass (string $addressClass)
335 335
     {
336 336
         $this->addressClass = $addressClass;
337 337
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
      *
346 346
      * @return object
347 347
      */
348
-    public function setLanguageClass(string $languageClass)
348
+    public function setLanguageClass (string $languageClass)
349 349
     {
350 350
         $this->languageClass = $languageClass;
351 351
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      *
358 358
      * @return \Illuminate\Contracts\Cache\Store
359 359
      */
360
-    public function getCacheStore(): \Illuminate\Contracts\Cache\Store
360
+    public function getCacheStore (): \Illuminate\Contracts\Cache\Store
361 361
     {
362 362
         return $this->cache->getStore();
363 363
     }
Please login to merge, or discard this patch.
src/Models/Country.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @return void
27 27
      */
28
-    public function __construct(array $attributes = [])
28
+    public function __construct (array $attributes = [])
29 29
     {
30 30
         parent::__construct($attributes);
31 31
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @return \Illuminate\Database\Eloquent\Relations\HasMany collection of languages used in the country
39 39
      */
40
-    public function languages(): HasMany
40
+    public function languages (): HasMany
41 41
     {
42 42
         return $this->hasMany(
43 43
             config('pwweb.localisation.models.languages'),
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @return string|array Localised country name.
56 56
      */
57
-    public function getNameAttribute($value)
57
+    public function getNameAttribute ($value)
58 58
     {
59 59
         if (null === $value || '' === $value) {
60 60
             return '';
61 61
         }
62 62
 
63
-        return __('pwweb::localization.' . $value);
63
+        return __('pwweb::localization.'.$value);
64 64
     }
65 65
 }
Please login to merge, or discard this patch.
src/Localisation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @param \Illuminate\Foundation\Application $app laravel application for further use
48 48
      */
49
-    public function __construct($app = null)
49
+    public function __construct ($app = null)
50 50
     {
51 51
         if (null === $app) {
52 52
             $app = app();
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return \Illuminate\Database\Eloquent\Collection a collection of active languages
65 65
      */
66
-    public static function languages(): Collection
66
+    public static function languages (): Collection
67 67
     {
68 68
         return Language::where('active', 1)->get();
69 69
     }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      *
76 76
      * @return \PWWEB\Localisation\Contracts\Language A language object
77 77
      */
78
-    public static function currentLanguage(string $locale = ''): LanguageContract
78
+    public static function currentLanguage (string $locale = ''): LanguageContract
79 79
     {
80 80
         $fallbackLocale = config('app.fallback_locale');
81 81
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         } else if ($locale === $fallbackLocale) {
85 85
             $locale = 'en-GB';
86 86
         } else {
87
-            $locale = $fallbackLocale . '-' . strtoupper($fallbackLocale);
87
+            $locale = $fallbackLocale.'-'.strtoupper($fallbackLocale);
88 88
         }
89 89
 
90 90
         try {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @return \Illuminate\Contracts\Support\Renderable language selector / switcher markup
103 103
      */
104
-    public static function languageSelector(): Renderable
104
+    public static function languageSelector (): Renderable
105 105
     {
106 106
         $languages = self::languages();
107 107
         $current = self::currentLanguage();
Please login to merge, or discard this patch.