DebugLogger   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A logBefore() 0 4 1
A __construct() 0 3 1
A logAfter() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PanicLabCore\Services\Debug\Log;
6
7
use function json_encode;
8
use Psr\Log\LoggerInterface;
9
10
class DebugLogger implements DebugLoggerInterface
11
{
12
    /** @var LoggerInterface */
13
    private $logger;
14
15 2
    public function __construct(LoggerInterface $logger)
16
    {
17 2
        $this->logger = $logger;
18 2
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 1
    public function logBefore(string $method, array $params): void
24
    {
25 1
        $this->logger->info(
26 1
            'Before \'' . $method . '\' with params: ' . json_encode($params)
27
        );
28 1
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33 1
    public function logAfter(string $method, array $result): void
34
    {
35 1
        $this->logger->info(
36 1
            'After \'' . $method . '\' with result: ' . json_encode($result)
37
        );
38 1
    }
39
}
40