PublishMessage   A
last analyzed

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 27
    public function __construct(string $className, string $event, string $routingKey, array $attributes = [])
18
    {
19 27
        $this->className = $className;
20 27
        $this->routingKey = $routingKey;
21 27
        $this->event = $event;
22 27
        $this->attributes = $attributes;
23
    }
24
25 19
    public function isDestroyed(): bool
26
    {
27 19
        return $this->event === self::EVENT_DESTROYED;
28
    }
29
30 15
    public function isCreated(): bool
31
    {
32 15
        return $this->event === self::EVENT_CREATED;
33
    }
34
35 21
    public function className(): string
36
    {
37 21
        return $this->className;
38
    }
39
40 1
    public function routingKey(): string
41
    {
42 1
        return $this->routingKey;
43
    }
44
45 21
    public function attributes(): array
46
    {
47 21
        return $this->attributes;
48
    }
49
50
    public function event(): string
51
    {
52
        return $this->event;
53
    }
54
}
55