Passed
Push — master ( caf7da...d55627 )
by Thomas Mauro
03:42
created

ClientProviderMiddleware::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TMV\OpenIdClient\Middleware;
6
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\ServerRequestInterface;
9
use Psr\Http\Server\MiddlewareInterface;
10
use Psr\Http\Server\RequestHandlerInterface;
11
use TMV\OpenIdClient\ClientInterface;
12
13
class ClientProviderMiddleware implements MiddlewareInterface
14
{
15
    /** @var ClientInterface */
16
    private $client;
17
18
    public function __construct(ClientInterface $client)
19
    {
20
        $this->client = $client;
21
    }
22
23
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
24
    {
25
        return $handler->handle($request->withAttribute(ClientInterface::class, $this->client));
26
    }
27
}
28