LoggedRequestValidator::validate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 12
ccs 11
cts 11
cp 1
rs 9.9666
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace CHStudio\Raven\Validator;
4
5
use Psr\Http\Message\RequestInterface;
6
use Psr\Log\LoggerInterface;
7
8
class LoggedRequestValidator implements RequestValidatorInterface
9
{
10 2
    public function __construct(
11
        private readonly LoggerInterface $logger,
12
        private readonly RequestValidatorInterface $decorated
13
    ) {
14 2
    }
15
16 1
    public function validate(RequestInterface $request): void
17
    {
18 1
        $this->logger->debug(sprintf(
19 1
            "Start testing Request: [%s] %s",
20 1
            $request->getMethod(),
21 1
            $request->getUri()
22 1
        ));
23 1
        $this->decorated->validate($request);
24 1
        $this->logger->debug(sprintf(
25 1
            'Finish testing Request: [%s] %s',
26 1
            $request->getMethod(),
27 1
            $request->getUri()
28 1
        ));
29
    }
30
}
31