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

QueueToEventDispatcherWithCommandId   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A fire() 0 5 1
1
<?php declare(strict_types = 1);
2
namespace SmoothPhp\LaravelAdapter\StrongConsistency;
3
4
use Carbon\Carbon;
5
use Illuminate\Contracts\Cache\Repository as Cache;
6
use SmoothPhp\LaravelAdapter\EventBus\QueueToEventDispatcher;
7
/**
8
 * Class QueueToEventDispatcherWithCommandId
9
 * @package SmoothPhp\LaravelAdapter\StrongConsistency
10
 * @author Simon Bennett <[email protected]>
11
 */
12
final class QueueToEventDispatcherWithCommandId
13
{
14
    /** @var QueueToEventDispatcher */
15
    private $queueToEventDispatcher;
16
17
    /** @var Cache */
18
    private $cache;
19
20
    /**
21
     * QueueToEventDispatcherWithCommandId constructor.
22
     * @param QueueToEventDispatcher $queueToEventDispatcher
23
     * @param Cache $cache
24
     */
25
    public function __construct(QueueToEventDispatcher $queueToEventDispatcher, Cache $cache)
26
    {
27
        $this->queueToEventDispatcher = $queueToEventDispatcher;
28
        $this->cache = $cache;
29
    }
30
31
    /**
32
     * @param $job
33
     * @param $data
34
     * @return mixed
35
     */
36
    public function fire($job, $data)
37
    {
38
        $this->queueToEventDispatcher->fire($job, $data);
39
        $this->cache->add($data['command_id'], new Carbon(), 1);
40
    }
41
}
42