Require2FA::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 9
rs 10
cc 2
nc 2
nop 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