@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @param Application $app Laravel application for further use. |
50 | 50 | */ |
51 | - public function __construct($app = null) |
|
51 | + public function __construct ($app = null) |
|
52 | 52 | { |
53 | 53 | if ($app === null) { |
54 | 54 | $app = app(); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return Collection A collection of active languages. |
67 | 67 | */ |
68 | - public static function languages(): Collection |
|
68 | + public static function languages (): Collection |
|
69 | 69 | { |
70 | 70 | return Language::where('active', 1)->get(); |
71 | 71 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return Language A language object |
79 | 79 | */ |
80 | - public static function currentLanguage(string $locale = ''): Language |
|
80 | + public static function currentLanguage (string $locale = ''): Language |
|
81 | 81 | { |
82 | 82 | $fallbackLocale = config('app.fallback_locale'); |
83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } else if ($locale === $fallbackLocale) { |
87 | 87 | $locale = 'en-gb'; |
88 | 88 | } else { |
89 | - $locale = $fallbackLocale . '-' . $fallbackLocale; |
|
89 | + $locale = $fallbackLocale.'-'.$fallbackLocale; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | try { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return Renderable Language selector / switcher markup. |
105 | 105 | */ |
106 | - public static function languageSelector(): Renderable |
|
106 | + public static function languageSelector (): Renderable |
|
107 | 107 | { |
108 | 108 | $languages = self::languages(); |
109 | 109 | $current = self::currentLanguage(); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * |
39 | 39 | * @return void |
40 | 40 | */ |
41 | - public function handle() |
|
41 | + public function handle () |
|
42 | 42 | { |
43 | 43 | if (app(LocalisationRegistrar::class)->forgetCachedLanguages() === true) { |
44 | 44 | $this->info('Language cache flushed.'); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param array $attributes Additional attributes for model initialisation. |
27 | 27 | */ |
28 | - public function __construct(array $attributes = []) |
|
28 | + public function __construct (array $attributes = []) |
|
29 | 29 | { |
30 | 30 | parent::__construct($attributes); |
31 | 31 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @param array $attributes Additional attributes for model initialisation. |
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 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('localisation.models.languages'), |
@@ -31,7 +31,7 @@ |
||
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 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param array $attributes additional attributes for model initialisation |
39 | 39 | */ |
40 | - public function __construct(array $attributes = []) |
|
40 | + public function __construct (array $attributes = []) |
|
41 | 41 | { |
42 | 42 | parent::__construct($attributes); |
43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * An address can be of only one type (e.g. private, work, etc). |
49 | 49 | */ |
50 | - public function type(): BelongsTo |
|
50 | + public function type (): BelongsTo |
|
51 | 51 | { |
52 | 52 | return $this->belongsTo(Address\Type::class); |
53 | 53 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * An address belongs to a country. |
57 | 57 | */ |
58 | - public function country(): BelongsTo |
|
58 | + public function country (): BelongsTo |
|
59 | 59 | { |
60 | 60 | return $this->belongsTo(Country::class); |
61 | 61 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @throws \PWWeb\Localisation\Exceptions\AddressDoesNotExist |
69 | 69 | */ |
70 | - public static function findById(int $id): AddressContract |
|
70 | + public static function findById (int $id): AddressContract |
|
71 | 71 | { |
72 | 72 | $address = static::getAddresses(['id' => $id])->first(); |
73 | 73 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return Collection collection of addresses |
87 | 87 | */ |
88 | - protected static function getAddresses(array $params = []): Collection |
|
88 | + protected static function getAddresses (array $params = []): Collection |
|
89 | 89 | { |
90 | 90 | return app(LocalisationRegistrar::class) |
91 | 91 | ->setAddressClass(static::class) |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param array $attributes Additional attributes for model initialisation. |
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 |
||
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('localisation.models.countries'), |
@@ -59,7 +59,7 @@ discard block |
||
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 |
||
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 |
||
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 | $locale = strtolower($locale); |
105 | 105 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return Collection Collection of languages. |
121 | 121 | */ |
122 | - protected static function getLanguages(array $params = []): Collection |
|
122 | + protected static function getLanguages (array $params = []): Collection |
|
123 | 123 | { |
124 | 124 | return app(LocalisationRegistrar::class) |
125 | 125 | ->setLanguageClass(static::class) |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return void |
31 | 31 | */ |
32 | - public function register() |
|
32 | + public function register () |
|
33 | 33 | { |
34 | 34 | $this->mergeConfigFrom( |
35 | - __DIR__ . '/../config/localisation.php', |
|
35 | + __DIR__.'/../config/localisation.php', |
|
36 | 36 | 'localisation' |
37 | 37 | ); |
38 | 38 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->app->make('PWWeb\Localisation\Controllers\IndexController'); |
41 | 41 | |
42 | 42 | // Register views. |
43 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'localisation'); |
|
43 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'localisation'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -51,22 +51,22 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @return void |
53 | 53 | */ |
54 | - public function boot(LocalisationRegistrar $localisationLoader, Filesystem $filesystem) |
|
54 | + public function boot (LocalisationRegistrar $localisationLoader, Filesystem $filesystem) |
|
55 | 55 | { |
56 | - include __DIR__ . '/../routes/web.php'; |
|
56 | + include __DIR__.'/../routes/web.php'; |
|
57 | 57 | |
58 | 58 | if (function_exists('config_path') === true) { |
59 | 59 | // function not available and 'publish' not relevant in Lumen |
60 | 60 | $this->publishes( |
61 | 61 | [ |
62 | - __DIR__ . '/../config/localisation.php' => config_path('localisation.php'), |
|
62 | + __DIR__.'/../config/localisation.php' => config_path('localisation.php'), |
|
63 | 63 | ], |
64 | 64 | 'config' |
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->publishes( |
68 | 68 | [ |
69 | - __DIR__ . '/../database/migrations/create_localisation_tables.php.stub' => $this->getMigrationFileName($filesystem), |
|
69 | + __DIR__.'/../database/migrations/create_localisation_tables.php.stub' => $this->getMigrationFileName($filesystem), |
|
70 | 70 | ], |
71 | 71 | 'migrations' |
72 | 72 | ); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $this->app->singleton( |
91 | 91 | LocalisationRegistrar::class, |
92 | - function ($app) use ($localisationLoader) { |
|
92 | + function($app) use ($localisationLoader) { |
|
93 | 93 | return $localisationLoader; |
94 | 94 | } |
95 | 95 | ); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return void |
102 | 102 | */ |
103 | - protected function registerModelBindings() |
|
103 | + protected function registerModelBindings () |
|
104 | 104 | { |
105 | 105 | $config = $this->app->config['localisation.models']; |
106 | 106 | |
@@ -116,16 +116,16 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return string Migration filename. |
118 | 118 | */ |
119 | - protected function getMigrationFileName(Filesystem $filesystem): string |
|
119 | + protected function getMigrationFileName (Filesystem $filesystem): string |
|
120 | 120 | { |
121 | 121 | $timestamp = date('Y_m_d_His', mktime(0, 0, 0, 1, 1, 2020)); |
122 | 122 | |
123 | - return Collection::make($this->app->databasePath() . DIRECTORY_SEPARATOR . 'migrations' . DIRECTORY_SEPARATOR) |
|
123 | + return Collection::make($this->app->databasePath().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR) |
|
124 | 124 | ->flatMap( |
125 | - function ($path) use ($filesystem) { |
|
126 | - return $filesystem->glob($path . '*_create_localisation_tables.php'); |
|
125 | + function($path) use ($filesystem) { |
|
126 | + return $filesystem->glob($path.'*_create_localisation_tables.php'); |
|
127 | 127 | } |
128 | - )->push($this->app->databasePath() . "/migrations/{$timestamp}_create_localisation_tables.php") |
|
128 | + )->push($this->app->databasePath()."/migrations/{$timestamp}_create_localisation_tables.php") |
|
129 | 129 | ->first(); |
130 | 130 | } |
131 | 131 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - public function run() |
|
29 | + public function run () |
|
30 | 30 | { |
31 | 31 | // Initializing variables. |
32 | 32 | $createdAt = date('Y-m-d H:i:s'); |