DebugLogger::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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