Locale   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
c 2
b 1
f 0
lcom 1
cbo 3
dl 0
loc 19
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the Tinyissue package.
5
 *
6
 * (c) Mohamed Alsharaf <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Tinyissue\Http\Middleware;
13
14
use Closure;
15
use Illuminate\Contracts\Auth\Guard;
16
use Illuminate\Http\Request;
17
18
/**
19
 * Locale is a Middleware class to set the locale for the current logged in user.
20
 *
21
 * @author Mohamed Alsharaf <[email protected]>
22
 */
23
class Locale extends MiddlewareAbstract
24
{
25
    /**
26
     * Handle an incoming request.
27
     *
28
     * @param Request  $request
29
     * @param \Closure $next
30
     *
31
     * @return mixed
32
     */
33 63
    public function handle(Request $request, Closure $next)
34
    {
35 63
        if (!$this->auth->guest()) {
36 55
            app()->setLocale($this->getLoggedUser()->language);
37
        }
38
39 63
        return $next($request);
40
    }
41
}
42