Passed
Pull Request — 1.2 (#405)
by
unknown
08:49
created

Localization   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 16
ccs 0
cts 4
cp 0
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 2
1
<?php
2
3
namespace A17\Twill\Http\Middleware;
4
5
use Closure;
6
7
class Localization
8
{
9
    /**
10
     * Handles an incoming request.
11
     *
12
     * @param \Illuminate\Http\Request $request
13
     * @param Closure $next
14
     * @return mixed
15
     */
16
    public function handle($request, Closure $next)
17
    {
18
        if ($request->user()->language) {
19
            app()->setLocale($request->user()->language);
0 ignored issues
show
introduced by
The method setLocale() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
            app()->/** @scrutinizer ignore-call */ setLocale($request->user()->language);
Loading history...
20
        }
21
22
        return $next($request);
23
    }
24
}
25