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.

PushEventsThroughQueue::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace SmoothPhp\LaravelAdapter\EventBus;
4
5
use Illuminate\Contracts\Config\Repository;
6
use Illuminate\Contracts\Queue\Queue;
7
use SmoothPhp\Contracts\Domain\DomainMessage;
8
use SmoothPhp\Contracts\EventBus\EventListener;
9
use SmoothPhp\Contracts\Serialization\Serializer;
10
11
/**
12
 * Class PushEventsThroughQueue
13
 * @package SmoothPhp\LaravelAdapter\EventBus
14
 * @author Simon Bennett <[email protected]>
15
 */
16
final class PushEventsThroughQueue implements EventListener
17
{
18
    /** @var Queue */
19
    private $queue;
20
21
    /** @var Serializer */
22
    private $serializer;
23
    /** @var Repository */
24
    private $config;
25
26
    /**
27
     * PushEventsThroughQueue constructor.
28
     * @param Queue $queue
29
     * @param Serializer $serializer
30
     * @param Repository $config
31
     */
32
    public function __construct(Queue $queue, Serializer $serializer, Repository $config)
33
    {
34
        $this->queue = $queue;
35
        $this->serializer = $serializer;
36
        $this->config = $config;
37
    }
38
39
    /**
40
     * @param DomainMessage $domainMessage
41
     * @return void
42
     */
43 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...
44
    {
45
        $this->queue->push(
46
            QueueToEventDispatcher::class,
47
            [
48
                'uuid'        => (string)$domainMessage->getId(),
49
                'playhead'    => $domainMessage->getPlayHead(),
50
                'metadata'    => json_encode($this->serializer->serialize($domainMessage->getMetadata())),
51
                'payload'     => json_encode($this->serializer->serialize($domainMessage->getPayload())),
52
                'recorded_on' => $domainMessage->getRecordedOn()->format('Y-m-d H:i:s'),
53
                'type'        => $domainMessage->getType(),
54
            ],
55
            $this->config->get('cqrses.queue_name', 'default')
56
        );
57
    }
58
}