@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @throws \Exception |
60 | 60 | * TODO: Make function Parameters interchangeable |
61 | 61 | */ |
62 | - public function translate($identifier , $parameters = null, $locale = '') { |
|
62 | + public function translate($identifier, $parameters = null, $locale = '') { |
|
63 | 63 | |
64 | 64 | // Validate the locale given as parameter or take the saved locale |
65 | 65 | if ($locale !== '' || $this->locale === '') { |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function addMissingIdentifier($identifier, $parameters, $group) { |
183 | 183 | |
184 | - if(! $this->hasIdentifier($identifier)) { |
|
184 | + if (!$this->hasIdentifier($identifier)) { |
|
185 | 185 | |
186 | 186 | // Save only the keys from the parameter array |
187 | 187 | $keys = []; |
188 | 188 | if (is_array($parameters)) { |
189 | - foreach($parameters as $key => $value) { |
|
189 | + foreach ($parameters as $key => $value) { |
|
190 | 190 | $keys[] = $key; |
191 | 191 | } |
192 | 192 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @param $parameters |
229 | 229 | * @return string |
230 | 230 | */ |
231 | - private function replaceParameter ($translation, $parameters) { |
|
231 | + private function replaceParameter($translation, $parameters) { |
|
232 | 232 | |
233 | 233 | // Go through each specified Parameter and replace its placeholder "{$key}" |
234 | 234 | foreach ($parameters as $key => $parameter) { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @return string |
250 | 250 | * @throws \Exception |
251 | 251 | */ |
252 | - private function returnMissingTranslation ($identifier, $locale) { |
|
252 | + private function returnMissingTranslation($identifier, $locale) { |
|
253 | 253 | |
254 | 254 | // Return identifier and locale for easier debug |
255 | 255 | if (config('app.env') !== 'production') { |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | // Fallback if empty locale was given (should be handled in middleware) |
282 | - if ($locale == ''){ |
|
282 | + if ($locale == '') { |
|
283 | 283 | if (session()->get('locale') != '') { |
284 | 284 | $locale = session()->get('locale'); |
285 | 285 | } |
@@ -289,19 +289,19 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | // If the given locale is not defined as valid, try to get a fallback locale |
292 | - if (!in_array($locale, $avail_locales)){ |
|
292 | + if (!in_array($locale, $avail_locales)) { |
|
293 | 293 | |
294 | 294 | $found_locales = []; |
295 | 295 | |
296 | 296 | // Find any available locale which contains the locale as substring |
297 | 297 | foreach ($avail_locales as $avail_locale) { |
298 | - if (strpos($avail_locale, $locale) !== false){ |
|
298 | + if (strpos($avail_locale, $locale) !== false) { |
|
299 | 299 | $found_locales[] = $avail_locale; |
300 | 300 | } |
301 | 301 | } |
302 | 302 | |
303 | 303 | // Check if default locale is inside the found locales. If it was, use it! |
304 | - if (in_array($default_locale, $found_locales)){ |
|
304 | + if (in_array($default_locale, $found_locales)) { |
|
305 | 305 | Log::warning('Locale "'.$locale.'" was not found! Falling back to default locale "'.$default_locale.'"'); |
306 | 306 | $locale = $default_locale; |
307 | 307 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @return array|mixed |
325 | 325 | */ |
326 | 326 | public function getAllTranslations($locale, $group) { |
327 | - if(!isset($this->aHandler[$locale])) { |
|
327 | + if (!isset($this->aHandler[$locale])) { |
|
328 | 328 | $this->aHandler[$locale] = $this->createHandler($locale); |
329 | 329 | } |
330 | 330 |