| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 18 | private function setLocale($locale, $request) |
||
| 19 | { |
||
| 20 | $allowedLangs = array_keys(Localizer::allowedLanguages()); |
||
| 21 | if (config('localizer.block_unallowed_langs') && !in_array($locale, $allowedLangs)) { |
||
| 22 | abort(404, 'Unallowed language'); |
||
| 23 | } |
||
| 24 | |||
| 25 | if (Auth::check()) { |
||
| 26 | $user = Auth::User(); |
||
| 27 | $user->locale = $locale; |
||
|
|
|||
| 28 | $user->save(); |
||
| 29 | } else { |
||
| 30 | $request->session()->put('locale', $locale); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 60 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: