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.

QueueToEventDispatcherWithCommandId::fire()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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