Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function handle($request, $next) |
||
18 | { |
||
19 | if (Session::has('nova_locale')) { |
||
20 | $locale = Session::get('nova_locale'); |
||
21 | } else { |
||
22 | $browserLocale = substr($request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2); |
||
23 | $databaseLocale = Locale::query()->select('id')->where('iso', '=', $browserLocale)->first(); |
||
|
|||
24 | if (! empty($databaseLocale)) { |
||
25 | $locale = $browserLocale; |
||
26 | } else { |
||
27 | $locale = config('app.locale'); |
||
28 | } |
||
29 | Session::put('nova_locale', $locale); |
||
30 | } |
||
31 | |||
32 | app()->setLocale($locale); |
||
33 | |||
34 | return $next($request); |
||
35 | } |
||
36 | } |
||
37 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.