MiddlewareRequestHandlerAdapter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\SlimPsr15;
6
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\ServerRequestInterface;
9
use Psr\Http\Server\RequestHandlerInterface;
10
11
final class MiddlewareRequestHandlerAdapter implements RequestHandlerInterface
12
{
13
    /**
14
     * @var ResponseInterface
15
     */
16
    private $response;
17
18
    /**
19
     * @var callable
20
     */
21
    private $next;
22
23 1
    public function __construct(ResponseInterface $response, callable $next)
24
    {
25 1
        $this->response = $response;
26 1
        $this->next = $next;
27 1
    }
28
29 1
    public function handle(ServerRequestInterface $request): ResponseInterface
30
    {
31 1
        $next = $this->next;
32
33 1
        return $next($request, $this->response);
34
    }
35
}
36