HandlerProcessorAdapter::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace Phact\Router\Invoker;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Psr\Http\Message\ServerRequestInterface;
7
use Psr\Http\Server\RequestHandlerInterface;
8
9
class HandlerProcessorAdapter implements RequestHandlerInterface
10
{
11
    /**
12
     * @var HandlerProcessorInterface
13
     */
14
    protected $processor;
15
16
    protected $originalHandler;
17
    /**
18
     * @var array
19
     */
20
    protected $variables;
21
22 16
    public function __construct(HandlerProcessorInterface $processor, $originalHandler, array $variables = [])
23
    {
24 16
        $this->processor = $processor;
25 16
        $this->originalHandler = $originalHandler;
26 16
        $this->variables = $variables;
27 16
    }
28
29
    /**
30
     * @inheritDoc
31
     */
32 14
    public function handle(ServerRequestInterface $request): ResponseInterface
33
    {
34 14
        return $this->processor->processHandler($request, $this->originalHandler, $this->variables);
35
    }
36
}
37