CallableAdapter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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