@@ -117,7 +117,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | - public function register() |
|
| 30 | + public function register () |
|
| 31 | 31 | { |
| 32 | 32 | $this->mergeConfigFrom( |
| 33 | - __DIR__ . '/../config/localisation.php', |
|
| 33 | + __DIR__.'/../config/localisation.php', |
|
| 34 | 34 | 'pwweb.localisation' |
| 35 | 35 | ); |
| 36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $this->app->make('PWWEB\Localisation\Controllers\IndexController'); |
| 39 | 39 | |
| 40 | 40 | // Register views. |
| 41 | - $this->loadViewsFrom(__DIR__ . '/resources/views', 'localisation'); |
|
| 41 | + $this->loadViewsFrom(__DIR__.'/resources/views', 'localisation'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -49,35 +49,35 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public function boot(LocalisationRegistrar $localisationLoader, Filesystem $filesystem) |
|
| 52 | + public function boot (LocalisationRegistrar $localisationLoader, Filesystem $filesystem) |
|
| 53 | 53 | { |
| 54 | - include __DIR__ . '/../routes/web.php'; |
|
| 54 | + include __DIR__.'/../routes/web.php'; |
|
| 55 | 55 | |
| 56 | 56 | if (true === function_exists('config_path')) { |
| 57 | 57 | // function not available and 'publish' not relevant in Lumen |
| 58 | 58 | $this->publishes( |
| 59 | 59 | [ |
| 60 | - __DIR__ . '/../config/localisation.php' => config_path('pwweb/localisation.php'), |
|
| 60 | + __DIR__.'/../config/localisation.php' => config_path('pwweb/localisation.php'), |
|
| 61 | 61 | ], |
| 62 | 62 | 'pwweb.localisation.config' |
| 63 | 63 | ); |
| 64 | 64 | |
| 65 | 65 | $this->publishes( |
| 66 | 66 | [ |
| 67 | - __DIR__ . '/../database/migrations/create_localisation_tables.php.stub' => $this->getMigrationFileName($filesystem), |
|
| 67 | + __DIR__.'/../database/migrations/create_localisation_tables.php.stub' => $this->getMigrationFileName($filesystem), |
|
| 68 | 68 | ], |
| 69 | 69 | 'pwweb.localisation.migrations' |
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | 72 | $this->publishes( |
| 73 | 73 | [ |
| 74 | - __DIR__ . '/resources/lang' => resource_path('lang/vendor/pwweb'), |
|
| 74 | + __DIR__.'/resources/lang' => resource_path('lang/vendor/pwweb'), |
|
| 75 | 75 | ] |
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | 78 | $this->publishes( |
| 79 | 79 | [ |
| 80 | - __DIR__ . '/resources/views' => base_path('resources/views/vendor/localisation'), |
|
| 80 | + __DIR__.'/resources/views' => base_path('resources/views/vendor/localisation'), |
|
| 81 | 81 | ], |
| 82 | 82 | 'views' |
| 83 | 83 | ); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | ] |
| 90 | 90 | ); |
| 91 | 91 | |
| 92 | - $this->loadTranslationsFrom(realpath(__DIR__ . '/resources/lang'), 'pwweb'); |
|
| 92 | + $this->loadTranslationsFrom(realpath(__DIR__.'/resources/lang'), 'pwweb'); |
|
| 93 | 93 | |
| 94 | 94 | $this->registerModelBindings(); |
| 95 | 95 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $this->app->singleton( |
| 104 | 104 | LocalisationRegistrar::class, |
| 105 | - function ($app) use ($localisationLoader) { |
|
| 105 | + function($app) use ($localisationLoader) { |
|
| 106 | 106 | return $localisationLoader; |
| 107 | 107 | } |
| 108 | 108 | ); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return void |
| 115 | 115 | */ |
| 116 | - protected function registerModelBindings() |
|
| 116 | + protected function registerModelBindings () |
|
| 117 | 117 | { |
| 118 | 118 | $config = $this->app->config['pwweb.localisation.models']; |
| 119 | 119 | |
@@ -129,16 +129,16 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return string migration filename |
| 131 | 131 | */ |
| 132 | - protected function getMigrationFileName(Filesystem $filesystem): string |
|
| 132 | + protected function getMigrationFileName (Filesystem $filesystem): string |
|
| 133 | 133 | { |
| 134 | 134 | $timestamp = date('Y_m_d_His', mktime(0, 0, 0, 1, 1, 2020)); |
| 135 | 135 | |
| 136 | - return Collection::make($this->app->databasePath() . DIRECTORY_SEPARATOR . 'migrations' . DIRECTORY_SEPARATOR) |
|
| 136 | + return Collection::make($this->app->databasePath().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR) |
|
| 137 | 137 | ->flatMap( |
| 138 | - function ($path) use ($filesystem) { |
|
| 139 | - return $filesystem->glob($path . '*_create_localisation_tables.php'); |
|
| 138 | + function($path) use ($filesystem) { |
|
| 139 | + return $filesystem->glob($path.'*_create_localisation_tables.php'); |
|
| 140 | 140 | } |
| 141 | - )->push($this->app->databasePath() . "/migrations/{$timestamp}_create_localisation_tables.php") |
|
| 141 | + )->push($this->app->databasePath()."/migrations/{$timestamp}_create_localisation_tables.php") |
|
| 142 | 142 | ->first(); |
| 143 | 143 | } |
| 144 | 144 | } |