Require2FA   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
c 0
b 0
f 0
dl 0
loc 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 9 2
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use App\Exceptions\TwoFactorRequiredException;
6
use Closure;
7
use PragmaRX\Google2FALaravel\Support\Authenticator;
8
use PragmaRX\Google2FALaravel\Middleware;
9
10
class Require2FA extends Middleware
11
{
12
    public function handle($request, Closure $next)
13
    {
14
        $authenticator = app(Authenticator::class)->boot($request);
0 ignored issues
show
Bug introduced by
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

14
        $authenticator = /** @scrutinizer ignore-call */ app(Authenticator::class)->boot($request);
Loading history...
15
16
        if (!$authenticator->isActivated()) {
17
            throw new TwoFactorRequiredException();
18
        }
19
20
        return parent::handle($request, $next);
21
    }
22
}
23