LaralangMiddleware::handle()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 3
Ratio 37.5 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 3
loc 8
rs 9.4285
cc 3
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace Aitor24\Laralang\Middleware;
4
5
use Closure;
6
use Crypt;
7
8
class LaralangMiddleware
9
{
10
    /**
11
     * Run the request filter.
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 View Code Duplication
        if (!session('laralang.password') || (Crypt::decrypt(session('laralang.password')) != config('laralang.default.password'))) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
            return redirect(Route('laralang::login'))->with('status', 'You should be logged into Laralang!');
22
        }
23
24
        return $next($request);
25
    }
26
}
27