Passed
Push — main ( 7dcca1...e70bce )
by Daniel
04:22
created

RequestLoggingMiddleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Api\Lib\Middleware;
6
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
use Psr\Log\LoggerInterface;
12
13
/**
14
 * Logs the incoming api requests
15
 */
16
final readonly class RequestLoggingMiddleware implements MiddlewareInterface
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_READONLY, expecting T_CLASS on line 16 at column 6
Loading history...
17
{
18 2
    public function __construct(
19
        private LoggerInterface $logger,
20
    ) {
21 2
    }
22
23 1
    public function process(
24
        ServerRequestInterface $request,
25
        RequestHandlerInterface $handler
26
    ): ResponseInterface {
27 1
        $this->logger->info(
28 1
            (string) $request->getUri()
29 1
        );
30
31 1
        return $handler->handle($request);
32
    }
33
}
34