Completed
Push — master ( 241ec6...70b488 )
by Antonio Carlos
04:26
created

Middleware::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 6
1
<?php
2
3
namespace PragmaRX\Google2FALaravel;
4
5
use Closure;
6
use PragmaRX\Google2FALaravel\Support\Authenticator;
7
8
class Middleware
9
{
10
    public function handle($request, Closure $next)
11
    {
12
        $authenticator = app(Authenticator::class)->boot($request);
13
14
        if ($authenticator->isAuthenticated()) {
15
            return $next($request);
16
        }
17
18
        return $authenticator->makeRequestOneTimePasswordResponse();
19
    }
20
}
21