| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | private function setLocale($locale, $request) |
||
| 21 | { |
||
| 22 | if (!in_array($locale, array_keys(Localizer::allowedLanguages()))) { |
||
| 23 | abort(404, "Lang '".$locale."' not found"); |
||
| 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 | |||
| 64 |
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: