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.

LoggableProducer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace AmqpWorkers\Loggable;
4
5
use AmqpWorkers\Exception\ProducerNotProperlyConfigured;
6
use AmqpWorkers\ProducerInterface;
7
use Psr\Log\LoggerInterface;
8
9
/**
10
 * This class is loggable implementation of Producer. It's just a decorator,
11
 * which delegates real producing into given implementation, and just logs all the events
12
 * @package AmqpWorkers\Loggable
13
 */
14
class LoggableProducer implements ProducerInterface
15
{
16
17
    /**
18
     * @var LoggerInterface
19
     */
20
    private $logger;
21
    /**
22
     * @var ProducerInterface
23
     */
24
    private $producer;
25
26
    public function __construct(LoggerInterface $logger, ProducerInterface $producer)
27
    {
28
        $this->logger = $logger;
29
        $this->producer = $producer;
30
    }
31
32
    /**
33
     * @param mixed $payload
34
     *
35
     * @todo: maybe add properties array as second parameter
36
     * @throws ProducerNotProperlyConfigured if queue nor exchange not given.
37
     */
38
    public function produce($payload)
39
    {
40
        $this->logger->debug('Got "%s" message, producing...', serialize($payload));
0 ignored issues
show
Documentation introduced by
serialize($payload) is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
41
        $this->producer->produce($payload);
42
        $this->logger->deubg('Produced "%s" message', serialize($payload));
0 ignored issues
show
Bug introduced by
The method deubg() does not seem to exist on object<Psr\Log\LoggerInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
    }
44
}
45