Completed
Push — master ( e55d65...bad107 )
by Vincent
10s
created

CheckAuthCodeRequestMiddleware::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 8
ccs 0
cts 4
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
crap 2
1
<?php
2
3
/*
4
 * This file is part of OAuth 2.0 Laravel.
5
 *
6
 * (c) Luca Degasperi <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LucaDegasperi\OAuth2Server\Middleware;
13
14
use Closure;
15
use LucaDegasperi\OAuth2Server\Authorizer;
16
17
/**
18
 * This is the check auth code request middleware class.
19
 *
20
 * @author Luca Degasperi <[email protected]>
21
 */
22
class CheckAuthCodeRequestMiddleware
23
{
24
    /**
25
     * The authorizer instance.
26
     *
27
     * @var \LucaDegasperi\OAuth2Server\Authorizer
28
     */
29
    protected $authorizer;
30
31
    /**
32
     * Create a new check auth code request middleware instance.
33
     *
34
     * @param \LucaDegasperi\OAuth2Server\Authorizer $authorizer
35
     */
36
    public function __construct(Authorizer $authorizer)
37
    {
38
        $this->authorizer = $authorizer;
39
    }
40
41
    /**
42
     * Handle an incoming request.
43
     *
44
     * @param \Illuminate\Http\Request  $request
45
     * @param \Closure $next
46
     *
47
     * @return mixed
48
     */
49
    public function handle($request, Closure $next)
50
    {
51
        $this->authorizer->setRequest($request);
52
53
        $this->authorizer->checkAuthCodeRequest();
54
55
        return $next($request);
56
    }
57
}
58