Completed
Pull Request — master (#746)
by
unknown
83:49 queued 18:51
created

CheckAuthCodeRequestMiddleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 1 Features 2
Metric Value
wmc 2
c 4
b 1
f 2
lcom 1
cbo 1
dl 0
loc 36
ccs 0
cts 7
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 8 1
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