Passed
Push — master ( 26669d...eddd64 )
by
unknown
04:41
created

PublishMessage   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 88.24%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 17
c 1
b 0
f 0
dl 0
loc 46
ccs 15
cts 17
cp 0.8824
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A isCreated() 0 3 1
A event() 0 3 1
A routingKey() 0 3 1
A attributes() 0 3 1
A isDestroyed() 0 3 1
A className() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\TableSync\Messages;
6
7
class PublishMessage
8
{
9
    public const EVENT_DESTROYED = 'deleted';
10
    public const EVENT_CREATED = 'created';
11
12
    private $className;
13
    private $routingKey;
14
    private $event;
15
    private $attributes;
16
17 26
    public function __construct(string $className, string $event, string $routingKey, array $attributes = [])
18
    {
19 26
        $this->className = $className;
20 26
        $this->routingKey = $routingKey;
21 26
        $this->event = $event;
22 26
        $this->attributes = $attributes;
23
    }
24
25 18
    public function isDestroyed(): bool
26
    {
27 18
        return $this->event === self::EVENT_DESTROYED;
28
    }
29
30 14
    public function isCreated(): bool
31
    {
32 14
        return $this->event === self::EVENT_CREATED;
33
    }
34
35 20
    public function className(): string
36
    {
37 20
        return $this->className;
38
    }
39
40 1
    public function routingKey(): string
41
    {
42 1
        return $this->routingKey;
43
    }
44
45 20
    public function attributes(): array
46
    {
47 20
        return $this->attributes;
48
    }
49
50
    public function event(): string
51
    {
52
        return $this->event;
53
    }
54
}
55