@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @param Application $app laravel application for further use |
| 47 | 47 | */ |
| 48 | - public function __construct($app = null) |
|
| 48 | + public function __construct ($app = null) |
|
| 49 | 49 | { |
| 50 | 50 | if (null === $app) { |
| 51 | 51 | $app = app(); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return Collection a collection of active languages |
| 64 | 64 | */ |
| 65 | - public static function languages(): Collection |
|
| 65 | + public static function languages (): Collection |
|
| 66 | 66 | { |
| 67 | 67 | return Language::where('active', 1)->get(); |
| 68 | 68 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return Language A language object |
| 76 | 76 | */ |
| 77 | - public static function currentLanguage(string $locale = ''): Language |
|
| 77 | + public static function currentLanguage (string $locale = ''): Language |
|
| 78 | 78 | { |
| 79 | 79 | $fallbackLocale = config('app.fallback_locale'); |
| 80 | 80 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } else if ($locale === $fallbackLocale) { |
| 84 | 84 | $locale = 'en-GB'; |
| 85 | 85 | } else { |
| 86 | - $locale = $fallbackLocale . '-' . strtoupper($fallbackLocale); |
|
| 86 | + $locale = $fallbackLocale.'-'.strtoupper($fallbackLocale); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | try { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @return Renderable language selector / switcher markup |
| 102 | 102 | */ |
| 103 | - public static function languageSelector(): Renderable |
|
| 103 | + public static function languageSelector (): Renderable |
|
| 104 | 104 | { |
| 105 | 105 | $languages = self::languages(); |
| 106 | 106 | $current = self::currentLanguage(); |
@@ -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 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |