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

NullLogger   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 16
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A log() 0 3 1
A __construct() 0 5 1
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