QueuePublisher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 14
ccs 0
cts 5
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A publish() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\TableSync\Integration\Laravel\Publishers;
6
7
use Illuminate\Contracts\Bus\Dispatcher;
8
use Umbrellio\TableSync\Integration\Laravel\Jobs\PublishJob;
9
use Umbrellio\TableSync\Messages\PublishMessage;
10
use Umbrellio\TableSync\Publisher;
11
12
final class QueuePublisher implements Publisher
13
{
14
    private $publisher;
15
    private $dispatcher;
16
17
    public function __construct(Publisher $publisher, Dispatcher $dispatcher)
18
    {
19
        $this->publisher = $publisher;
20
        $this->dispatcher = $dispatcher;
21
    }
22
23
    public function publish(PublishMessage $message): void
24
    {
25
        $this->dispatcher->dispatch(new PublishJob(get_class($this->publisher), $message));
26
    }
27
}
28