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.
Completed
Push — master ( d211ba...2177e0 )
by Marc
02:13
created

LaravelLocalizationViewPath::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 2
1
<?php
2
3
namespace Mcamara\LaravelLocalization\Middleware;
4
5
use Closure;
6
use Illuminate\Support\Facades\View;
7
use Illuminate\Http\Request;
8
9
class LaravelLocalizationViewPath extends LaravelLocalizationMiddlewareBase 
10
{
11
    /**
12
     * Handle an incoming request.
13
     *
14
     * @param \Illuminate\Http\Request $request
15
     * @param \Closure                 $next
16
     *
17
     * @return mixed
18
     */
19
    public function handle($request, Closure $next) {
20
21
        // If the URL of the request is in exceptions.
22
        if ($this->shouldIgnore($request)) {
23
            return $next($request);
24
        }
25
26
        $app = app();
0 ignored issues
show
Unused Code introduced by
$app is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
27
        
28
        $currentLocale = app('laravellocalization')->getCurrentLocale();
29
        $viewPath = resource_path('views/' . $currentLocale);
30
        
31
        // Add current locale-code to view-paths
32
        View::addLocation($viewPath);
33
34
        return $next($request);
35
    }
36
37
}
38