@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $fileTranslations = parent::load($locale, $group, $namespace); |
21 | 21 | |
22 | - if (! is_null($namespace) && '*' !== $namespace) { |
|
22 | + if (!is_null($namespace) && '*' !== $namespace) { |
|
23 | 23 | return $fileTranslations; |
24 | 24 | } |
25 | 25 | |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | string $namespace = null |
42 | 42 | ): array { |
43 | 43 | return collect(config('laravel-multilingual.translation_loaders')) |
44 | - ->map(function (string $className) { |
|
44 | + ->map(function(string $className) { |
|
45 | 45 | return app($className); |
46 | 46 | }) |
47 | - ->mapWithKeys(function (TranslationLoader $translationLoader) use ($locale, $group, $namespace) { |
|
47 | + ->mapWithKeys(function(TranslationLoader $translationLoader) use ($locale, $group, $namespace) { |
|
48 | 48 | return $translationLoader->loadTranslations($locale, $group, $namespace); |
49 | 49 | }) |
50 | 50 | ->toArray(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function available(): Collection |
72 | 72 | { |
73 | - if (! array_key_exists('available', $this->items)) { |
|
73 | + if (!array_key_exists('available', $this->items)) { |
|
74 | 74 | $locales = collect($this->config->get('laravel-multilingual.locales')); |
75 | 75 | |
76 | 76 | $this->items['available'] = $locales->flatten()->unique(); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | throw new LocaleServiceNotAvailableException(); |
97 | 97 | } |
98 | 98 | |
99 | - return $service->mapWithKeys(function ($locale) { |
|
99 | + return $service->mapWithKeys(function($locale) { |
|
100 | 100 | return [$locale => $locale]; |
101 | 101 | }); |
102 | 102 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function setCurrentLocaleAttribute(string $locale): self |
115 | 115 | { |
116 | - if (! $this->isAvailable($locale)) { |
|
116 | + if (!$this->isAvailable($locale)) { |
|
117 | 117 | throw new LocaleNotAvailableException(); |
118 | 118 | } |
119 | 119 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function getOrFail(string $locale, string $service = null): string |
141 | 141 | { |
142 | - if (! $this->isAvailable($locale, $service)) { |
|
142 | + if (!$this->isAvailable($locale, $service)) { |
|
143 | 143 | throw new LocaleNotAvailableException(); |
144 | 144 | } |
145 | 145 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | { |
15 | 15 | foreach ($this->getConfiguredModelClass() as $model) { |
16 | 16 | $translation = $model::getTranslationsForGroup($locale, $group); |
17 | - if (! empty($translation)) { |
|
17 | + if (!empty($translation)) { |
|
18 | 18 | return $translation; |
19 | 19 | } |
20 | 20 | } |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public static function bootTranslationCalls() |
13 | 13 | { |
14 | - static::updated(function (self $model) { |
|
14 | + static::updated(function(self $model) { |
|
15 | 15 | $model->flushGroupCache(); |
16 | 16 | }); |
17 | 17 | |
18 | - static::deleted(function (self $model) { |
|
18 | + static::deleted(function(self $model) { |
|
19 | 19 | $model->flushGroupCache(); |
20 | 20 | }); |
21 | 21 | } |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public static function getTranslationsForGroup(string $locale, string $group): array |
32 | 32 | { |
33 | - return Cache::rememberForever(static::getCacheKey($group, $locale), function () use ($group, $locale) { |
|
33 | + return Cache::rememberForever(static::getCacheKey($group, $locale), function() use ($group, $locale) { |
|
34 | 34 | return static::query() |
35 | - ->where(function ($query) use ($group) { |
|
35 | + ->where(function($query) use ($group) { |
|
36 | 36 | $query->where('group', $group); |
37 | 37 | $query->orWhere('group', 'LIKE', $group.'.%'); |
38 | 38 | }) |
39 | 39 | ->where('locale', $locale) |
40 | 40 | ->get() |
41 | - ->reduce(function ($lines, $model) use ($group) { |
|
42 | - if (! is_null($model->value)) { |
|
41 | + ->reduce(function($lines, $model) use ($group) { |
|
42 | + if (!is_null($model->value)) { |
|
43 | 43 | $group = collect(explode('.', $model->group)) |
44 | 44 | ->slice(1) // Remove first entry for laravel compatibility. The first segment is the filename on the default file loader. |
45 | 45 | ->push($model->key) // Push translation key as a last segment |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public static function bootTranslatable() |
26 | 26 | { |
27 | - static::saved(function (Model $model) { |
|
27 | + static::saved(function(Model $model) { |
|
28 | 28 | foreach ($model->translationValues as $attributeName=>$values) { |
29 | 29 | $model->storeAttributeTranslations($attributeName, $values); |
30 | 30 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function translatableAttributeOrFail($attribute): string |
59 | 59 | { |
60 | - if (! $this->hasTranslatableAttribute($attribute)) { |
|
60 | + if (!$this->hasTranslatableAttribute($attribute)) { |
|
61 | 61 | throw new TranslatableAttributeNotDefinedException(sprintf('Translatable attribute "%s" not defined', $attribute)); |
62 | 62 | } |
63 | 63 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function translatableTypeOrFail(string $type): string |
89 | 89 | { |
90 | - if (! $this->translatableTypeExists($type)) { |
|
90 | + if (!$this->translatableTypeExists($type)) { |
|
91 | 91 | throw new TranslatableAttributeTypeNotDefinedException(sprintf('Attribute type "%s" not defined', $type)); |
92 | 92 | } |
93 | 93 | |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | // Convert scalar values to array |
177 | - $value = ! is_array($value) ? [$locale => $value] : $value; |
|
177 | + $value = !is_array($value) ? [$locale => $value] : $value; |
|
178 | 178 | |
179 | 179 | // Map values to translation attributes |
180 | - $this->translationValues[$name] = collect($value)->mapWithKeys(function ($value, $locale) { |
|
180 | + $this->translationValues[$name] = collect($value)->mapWithKeys(function($value, $locale) { |
|
181 | 181 | return [$locale => $value]; |
182 | 182 | })->toArray(); |
183 | 183 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | // Load translations, if there are no values for the given attribute |
207 | - if (! array_key_exists($name, $this->translationValues)) { |
|
207 | + if (!array_key_exists($name, $this->translationValues)) { |
|
208 | 208 | $this->loadAttributeTranslations($name); |
209 | 209 | } |
210 | 210 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | { |
257 | 257 | $translations = $this->translatableRelationByAttribute($attribute)->where('key', $attribute)->get(); |
258 | 258 | |
259 | - $this->translationValues[$attribute] = collect($translations)->mapWithKeys(function ($item) { |
|
259 | + $this->translationValues[$attribute] = collect($translations)->mapWithKeys(function($item) { |
|
260 | 260 | return [$item->locale => $item->value]; |
261 | 261 | })->toArray(); |
262 | 262 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $locale = app(Locale::class)->current; |
289 | 289 | } |
290 | 290 | |
291 | - return collect($this->translations)->map(function ($type, $key) use ($locale) { |
|
291 | + return collect($this->translations)->map(function($type, $key) use ($locale) { |
|
292 | 292 | return $this->getAttributeTranslation($key, $locale); |
293 | 293 | })->toArray(); |
294 | 294 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function match(Request $request, Locale $locale): bool |
17 | 17 | { |
18 | - return ! empty($this->detectPreferredLanguage()); |
|
18 | + return !empty($this->detectPreferredLanguage()); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |