NoCacheMiddleware   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 8
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace Koded\Framework\Middleware;
4
5
use Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
6
use Psr\Http\Server\{MiddlewareInterface, RequestHandlerInterface};
7
8
/**
9
 * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
10
 */
11
class NoCacheMiddleware implements MiddlewareInterface
12
{
13
    public function process(
14
        ServerRequestInterface $request,
15
        RequestHandlerInterface $handler): ResponseInterface
16
    {
17
        return $handler->handle($request)
0 ignored issues
show
Bug Best Practice introduced by
The expression return $handler->handle(... 'no-cache, max-age=0') returns the type Psr\Http\Message\MessageInterface which includes types incompatible with the type-hinted return Psr\Http\Message\ResponseInterface.
Loading history...
18
            ->withHeader('Cache-Control', 'no-cache, max-age=0');
19
    }
20
}
21