Completed
Push — master ( 21c015...b85bcf )
by Antonio Carlos
07:14 queued 05:46
created

Middleware::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

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