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.
Completed
Push — master ( 200536...4b06eb )
by Simon
05:26
created

PushEventThroughQueueWithCommandId::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 15
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 15
loc 15
rs 9.4285
cc 1
eloc 10
nc 1
nop 1
1
<?php declare(strict_types = 1);
2
namespace SmoothPhp\LaravelAdapter\StrongConsistency;
3
4
use FlixPremiere\Laravel\CommandNotfication\CommandBus\NotificationsCommandBus;
5
use Illuminate\Contracts\Queue\Queue;
6
use SmoothPhp\Contracts\CommandBus\CommandBus;
7
use SmoothPhp\Contracts\Domain\DomainMessage;
8
use SmoothPhp\Contracts\EventBus\EventListener;
9
use SmoothPhp\Contracts\Serialization\Serializer;
10
11
/**
12
 * Class PushEventThroughQueueWithCommandId
13
 * @package SmoothPhp\LaravelAdapter\StrongConsistency
14
 * @author Simon Bennett <[email protected]>
15
 */
16
final class PushEventThroughQueueWithCommandId implements EventListener
17
{
18
    /** @var Queue */
19
    private $queue;
20
21
    /** @var Serializer */
22
    private $serializer;
23
24
    /** @var NotificationsCommandBus */
25
    private $notificationsCommandBus;
26
27
    /**
28
     * PushEventsThroughQueue constructor.
29
     * @param Queue $queue
30
     * @param Serializer $serializer
31
     * @param StrongConsistencyCommandBus|CommandBus $notificationsCommandBus
32
     */
33
    public function __construct(Queue $queue, Serializer $serializer, CommandBus $notificationsCommandBus)
34
    {
35
        $this->queue = $queue;
36
        $this->serializer = $serializer;
37
        $this->notificationsCommandBus = $notificationsCommandBus;
0 ignored issues
show
Documentation Bug introduced by
It seems like $notificationsCommandBus of type object<SmoothPhp\Contracts\CommandBus\CommandBus> is incompatible with the declared type object<FlixPremiere\Lara...otificationsCommandBus> of property $notificationsCommandBus.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
38
    }
39
40
    /**
41
     * @param DomainMessage $domainMessage
42
     * @return void
43
     */
44 View Code Duplication
    public function handle(DomainMessage $domainMessage)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
45
    {
46
        $this->queue->push(
47
            QueueToEventDispatcherWithCommandId::class,
48
            [
49
                'uuid'        => (string)$domainMessage->getId(),
50
                'playhead'    => $domainMessage->getPlayHead(),
51
                'metadata'    => json_encode($this->serializer->serialize($domainMessage->getMetadata())),
52
                'payload'     => json_encode($this->serializer->serialize($domainMessage->getPayload())),
53
                'recorded_on' => (string)$domainMessage->getRecordedOn(),
54
                'type'        => $domainMessage->getType(),
55
                'command_id'  => $this->notificationsCommandBus->getLastCommandId(),
56
            ]
57
        );
58
    }
59
}
60