GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ChannelLogger   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 34
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A log() 0 12 1
1
<?php declare(strict_types=1);
2
3
namespace WyriHaximus\React\PSR3\Bunny;
4
5
use Bunny\Channel;
6
use Psr\Log\AbstractLogger;
7
use function WyriHaximus\PSR3\checkCorrectLogLevel;
8
use function WyriHaximus\PSR3\normalizeContext;
9
use function WyriHaximus\PSR3\processPlaceHolders;
10
11
final class ChannelLogger extends AbstractLogger
12
{
13
    /**
14
     * @var Channel
15
     */
16
    private $channel;
17
18
    /**
19
     * @var array
20
     */
21
    private $publishArguments;
22
23
    /**
24
     * @param Channel $channel
25
     * @param array   $publishArguments
26
     */
27 14
    public function __construct(Channel $channel, ...$publishArguments)
28
    {
29 14
        $this->channel = $channel;
30 14
        $this->publishArguments = $publishArguments;
31 14
    }
32
33 13
    public function log($level, $message, array $context = [])
34
    {
35 13
        checkCorrectLogLevel($level);
36 12
        $context = normalizeContext($context);
37 12
        $message = (string)$message;
38 12
        $message = processPlaceHolders($message, $context);
39 12
        $json = json_encode([
40 12
            'level' => $level,
41 12
            'message' => $message,
42 12
            'context' => $context,
43
        ]);
44 12
        $this->channel->publish($json, ...$this->publishArguments);
0 ignored issues
show
Bug introduced by
$this->publishArguments is expanded, but the parameter $headers of Bunny\Channel::publish() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

44
        $this->channel->publish($json, /** @scrutinizer ignore-type */ ...$this->publishArguments);
Loading history...
45 12
    }
46
}
47