GeneratedByMiddleware   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 5
dl 0
loc 13
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Ctw\Middleware\GeneratedByMiddleware;
5
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\ServerRequestInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
10
class GeneratedByMiddleware extends AbstractGeneratedByMiddleware
11
{
12
    /**
13
     * @var string
14
     */
15
    private const HEADER = 'X-Generated-By';
16
17 4
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
18
    {
19 4
        $response = $handler->handle($request);
20 4
        $server   = $request->getServerParams();
21
22 4
        return $response->withHeader(self::HEADER, $this->getServerId($server));
23
    }
24
}
25