EmptyEndpointMiddleware   A
last analyzed

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