AuthorizationMiddleware   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 28
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 3 1
1
<?php
2
3
namespace DMT\Auth;
4
5
use Psr\Http\Message\RequestInterface;
6
7
/**
8
 * Class AuthorizationMiddleware
9
 *
10
 * @package DMT\Auth
11
 */
12
class AuthorizationMiddleware
13
{
14
    /**
15
     * @var AuthorizationInterface
16
     */
17
    protected $authorization;
18
19
    /**
20
     * AuthorizationMiddleware constructor.
21
     *
22
     * @param AuthorizationInterface $authorization
23
     */
24 4
    public function __construct(AuthorizationInterface $authorization)
25
    {
26 4
        $this->authorization = $authorization;
27 4
    }
28
29
    /**
30
     * Apply the authorization headers to the request.
31
     *
32
     * @param RequestInterface $request
33
     *
34
     * @return RequestInterface
35
     * @throws AuthorizationException
36
     */
37 4
    public function __invoke(RequestInterface $request)
38
    {
39 4
        return $this->authorization->handle($request);
40
    }
41
}
42