Completed
Pull Request — master (#27)
by Frederic
04:50 queued 02:40
created

SendMetricListenerProvider::provideListeners()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 8
cts 8
cp 1
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Burrow\Event\Listener\Metric;
4
5
use Burrow\Event\DaemonStarted;
6
use Burrow\Event\DaemonStopped;
7
use Burrow\Event\MessageConsumed;
8
use Burrow\Event\MessageReceived;
9
use Burrow\Metric\MetricService;
10
use League\Event\ListenerAcceptorInterface;
11
use League\Event\ListenerProviderInterface;
12
13
class SendMetricListenerProvider implements ListenerProviderInterface
14
{
15
    /** @var MetricService  */
16
    private $metricService;
17
18
    /**
19
     * SendMetricSubscriber constructor.
20
     *
21
     * @param MetricService $metricService
22
     */
23 3
    public function __construct(MetricService $metricService)
24
    {
25 3
        $this->metricService = $metricService;
26 3
    }
27
28
    /**
29
     * @param ListenerAcceptorInterface $listenerAcceptor
30
     *
31
     * @return ListenerProviderInterface|void
32
     */
33 3
    public function provideListeners(ListenerAcceptorInterface $listenerAcceptor)
34
    {
35 3
        $listenerAcceptor->addListener(DaemonStarted::NAME, new SendMetricOnDaemonStarted($this->metricService));
0 ignored issues
show
Documentation introduced by
new \Burrow\Event\Listen...d($this->metricService) is of type object<Burrow\Event\List...dMetricOnDaemonStarted>, but the function expects a callable.

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...
36 3
        $listenerAcceptor->addListener(DaemonStopped::NAME, new SendMetricOnDaemonStopped($this->metricService));
0 ignored issues
show
Documentation introduced by
new \Burrow\Event\Listen...d($this->metricService) is of type object<Burrow\Event\List...dMetricOnDaemonStopped>, but the function expects a callable.

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...
37 3
        $listenerAcceptor->addListener(MessageReceived::NAME, new SendMetricOnMessageReceived($this->metricService));
0 ignored issues
show
Documentation introduced by
new \Burrow\Event\Listen...d($this->metricService) is of type object<Burrow\Event\List...etricOnMessageReceived>, but the function expects a callable.

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...
38
39 3
        $sendMetricOnMessageConsumed = new SendMetricOnMessageConsumed($this->metricService);
40 3
        $listenerAcceptor->addListener(MessageReceived::NAME, $sendMetricOnMessageConsumed);
0 ignored issues
show
Documentation introduced by
$sendMetricOnMessageConsumed is of type object<Burrow\Event\List...etricOnMessageConsumed>, but the function expects a callable.

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 3
        $listenerAcceptor->addListener(MessageConsumed::NAME, $sendMetricOnMessageConsumed);
0 ignored issues
show
Documentation introduced by
$sendMetricOnMessageConsumed is of type object<Burrow\Event\List...etricOnMessageConsumed>, but the function expects a callable.

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...
42 3
    }
43
}
44