PublishMessage::event()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
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