@@ -23,7 +23,7 @@ |
||
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 |
@@ -23,7 +23,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return \Illuminate\Contracts\Support\Renderable |
15 | 15 | */ |
16 | - public function index() |
|
16 | + public function index () |
|
17 | 17 | { |
18 | 18 | } |
19 | 19 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return \Illuminate\Contracts\Support\Renderable |
24 | 24 | */ |
25 | - public function create() |
|
25 | + public function create () |
|
26 | 26 | { |
27 | 27 | $types = Type::all(); |
28 | 28 | $countries = Country::all(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return \Illuminate\Contracts\Support\Renderable |
37 | 37 | */ |
38 | - public function store() |
|
38 | + public function store () |
|
39 | 39 | { |
40 | 40 | } |
41 | 41 | } |
@@ -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 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return void |
40 | 40 | */ |
41 | - public function __construct(array $attributes = []) |
|
41 | + public function __construct (array $attributes = []) |
|
42 | 42 | { |
43 | 43 | parent::__construct($attributes); |
44 | 44 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
52 | 52 | */ |
53 | - public function type(): BelongsTo |
|
53 | + public function type (): BelongsTo |
|
54 | 54 | { |
55 | 55 | return $this->belongsTo(Address\Type::class); |
56 | 56 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
62 | 62 | */ |
63 | - public function country(): BelongsTo |
|
63 | + public function country (): BelongsTo |
|
64 | 64 | { |
65 | 65 | return $this->belongsTo(Country::class); |
66 | 66 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return \PWWEB\Localisation\Contracts\Address |
76 | 76 | */ |
77 | - public static function findById(int $id): AddressContract |
|
77 | + public static function findById (int $id): AddressContract |
|
78 | 78 | { |
79 | 79 | $address = static::getAddresses(['id' => $id])->first(); |
80 | 80 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return \PWWEB\Localisation\Contracts\Address |
96 | 96 | */ |
97 | - public static function findByType(string $type): AddressContract |
|
97 | + public static function findByType (string $type): AddressContract |
|
98 | 98 | { |
99 | 99 | $address = static::getAddresses(['type' => $type])->first(); |
100 | 100 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return Collection collection of addresses |
114 | 114 | */ |
115 | - protected static function getAddresses(array $params = []): Collection |
|
115 | + protected static function getAddresses (array $params = []): Collection |
|
116 | 116 | { |
117 | 117 | return app(LocalisationRegistrar::class) |
118 | 118 | ->setAddressClass(static::class) |
@@ -28,7 +28,7 @@ discard block |
||
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 |
||
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 |
||
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 | $language = static::getLanguages(['locale' => $locale])->first(); |
105 | 105 | |
@@ -117,7 +117,7 @@ discard block |
||
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 |
||
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); |
@@ -31,7 +31,7 @@ discard block |
||
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 | |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return string |
47 | 47 | */ |
48 | - public function getNameAttribute($value) |
|
48 | + public function getNameAttribute ($value) |
|
49 | 49 | { |
50 | 50 | if (null === $value || '' === $value) { |
51 | 51 | return ''; |
52 | 52 | } |
53 | 53 | |
54 | - return __('pwweb::localization.' . $value); |
|
54 | + return __('pwweb::localization.'.$value); |
|
55 | 55 | } |
56 | 56 | } |
@@ -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 |