Passed
Pull Request — master (#224)
by Alexander
07:32
created

MiddlewareHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Yiisoft\Yii\Web\RequestHandler;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Psr\Http\Message\ServerRequestInterface;
7
use Psr\Http\Server\MiddlewareInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
10
final class MiddlewareHandler implements RequestHandlerInterface
11
{
12
    private MiddlewareInterface $middleware;
13
    private RequestHandlerInterface $handler;
14
15
    public function __construct(MiddlewareInterface $middleware, RequestHandlerInterface $handler)
16
    {
17
        $this->middleware = $middleware;
18
        $this->handler = $handler;
19
    }
20
21
    public function handle(ServerRequestInterface $request): ResponseInterface
22
    {
23
        return $this->middleware->process($request, $this->handler);
24
    }
25
}
26