Test Failed
Pull Request — master (#952)
by Maxim
16:49 queued 07:48
created

NullLogger::log()   A

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 3
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 Spiral\Logger;
6
7
use Psr\Log\LoggerInterface;
8
use Psr\Log\LoggerTrait;
9
10
/**
11
 * Simply forwards debug messages into various locations.
12
 */
13
final class NullLogger implements LoggerInterface
14
{
15
    use LoggerTrait;
16
17
    private readonly \Closure $receptor;
18
19 292
    public function __construct(
20
        callable $receptor,
21
        private string $channel
22
    ) {
23 292
        $this->receptor = $receptor(...);
0 ignored issues
show
Bug introduced by
The property receptor is declared read-only in Spiral\Logger\NullLogger.
Loading history...
24
    }
25
26 292
    public function log(mixed $level, $message, array $context = []): void
27
    {
28 292
        \call_user_func($this->receptor, $this->channel, $level, $message, $context);
29
    }
30
}
31