GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SetLocale::handle()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 5
nc 3
nop 2
dl 0
loc 11
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use App;
6
use Closure;
7
8
class SetLocale
9
{
10
    /**
11
     * Handle an incoming request.
12
     *
13
     * @param \Illuminate\Http\Request $request
14
     * @param \Closure                 $next
15
     *
16
     * @return mixed
17
     */
18
    public function handle($request, Closure $next)
19
    {
20
        /** @var App\Models\User $user */
21
        if ($user = $request->user()) {
22
            if ($user->locale) {
23
                App::setLocale($user->locale);
24
            }
25
        }
26
27
        return $next($request);
28
    }
29
}
30