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.

QueueToEventDispatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A fire() 0 14 1
1
<?php declare(strict_types=1);
2
3
namespace SmoothPhp\LaravelAdapter\EventBus;
4
5
use SmoothPhp\Contracts\EventDispatcher\EventDispatcher;
6
use SmoothPhp\Contracts\Serialization\Serializer;
7
8
/**
9
 * Class QueueToEventDispatcher
10
 * @package SmoothPhp\LaravelAdapter\EventBus
11
 * @author Simon Bennett <[email protected]>
12
 */
13
final class QueueToEventDispatcher
14
{
15
    /** @var EventDispatcher */
16
    private $eventDispatcher;
17
18
    /** @var Serializer */
19
    private $serializer;
20
21
    /**
22
     * QueueToEventDispatcher constructor.
23
     * @param EventDispatcher $eventDispatcher
24
     * @param Serializer $serializer
25
     */
26
    public function __construct(EventDispatcher $eventDispatcher, Serializer $serializer)
27
    {
28
        $this->eventDispatcher = $eventDispatcher;
29
        $this->serializer = $serializer;
30
    }
31
32
    /**
33
     * @param $job
34
     * @param $data
35
     * @return mixed
36
     */
37
    public function fire($job, $data)
38
    {
39
        $payload = (json_decode($data['payload'],true));
40
41
        $event = call_user_func([
42
                                    str_replace('.', '\\', $data['type']),
43
                                    'deserialize'
44
                                ],
45
                                $payload['payload']);
46
47
        $this->eventDispatcher->dispatch($data['type'], [$event]);
48
49
        return $job->delete();
50
    }
51
52
}