Completed
Pull Request — master (#12)
by
unknown
13:02
created

EmptyEndpointMiddleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 2
1
<?php
2
3
4
namespace hiapi\Core\Http\Psr15\Middleware;
5
6
7
use hiapi\Core\Http\Psr7\Response\FatResponse;
8
use Psr\Http\Message\ResponseInterface;
9
use Psr\Http\Message\ServerRequestInterface;
10
use Psr\Http\Server\MiddlewareInterface;
11
use Psr\Http\Server\RequestHandlerInterface;
12
13
final class EmptyEndpointMiddleware implements MiddlewareInterface
14
{
15
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
16
    {
17
        if ($request->getUri()->getPath() === '/emptyEndpoint') {
18
            return FatResponse::create([], $request);
19
        }
20
21
        return $handler->handle($request);
22
    }
23
}
24