CallableAdapter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
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 18
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace PTS\PSR15Routing;
5
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\ServerRequestInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
10
class CallableAdapter implements RequestHandlerInterface
11
{
12
    /** @var callable */
13
    protected $realHandler;
14
15 1
    public function __construct(callable $handler)
16
    {
17 1
        $this->realHandler = $handler;
18 1
    }
19
20
    /**
21
     * @inheritdoc
22
     */
23 1
    public function handle(ServerRequestInterface $request): ResponseInterface
24
    {
25 1
        return \call_user_func($this->realHandler, $request);
26
    }
27
}
28