Passed
Push — main ( ed1bb6...4383ba )
by Slawomir
04:39
created

PostUpdatedCommentsIEvent   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 65
ccs 17
cts 17
cp 1
rs 10
c 1
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getLastVersion() 0 3 1
A getTitle() 0 3 1
A getTags() 0 3 1
A __construct() 0 7 1
A getName() 0 3 1
1
<?php
2
3
namespace App\Modules\Comments\Api\Event\Inbound;
4
5
use App\Infrastructure\Events\ApplicationInboundEvent;
6
use Symfony\Component\Uid\Ulid;
7
8
class PostUpdatedCommentsIEvent extends ApplicationInboundEvent
9
{
10
    const EVENT_NAME = "POST_UPDATED";
11
12
    private Ulid $id;
13
14
    private string $title;
15
16
17
    private array $tags;
18
19
    private int $lastVersion;
20
21
    /**
22
     * @param array $data
23
     */
24
    public function __construct(array $data)
25
    {
26
        parent::__construct($data);
27 5
        $this->id = $this->ulid('id');
28
        $this->title = $this->string('title');
29 5
        $this->tags = $this->array('tags');
30 5
        $this->lastVersion = $this->int('lastVersion');
31 5
    }
32 5
33 5
34 5
    /**
35 5
     * @return Ulid
36 5
     */
37
    public function getId(): Ulid
38
    {
39
        return $this->id;
40
    }
41
42 4
    /**
43
     * @return string
44 4
     */
45
    public function getTitle(): string
46
    {
47
        return $this->title;
48
    }
49
50 4
    /**
51
     * @return array
52 4
     */
53
    public function getTags(): array
54
    {
55
        return $this->tags;
56
    }
57
58 4
    /**
59
     * @return int
60 4
     */
61
    public function getLastVersion(): int
62
    {
63
        return $this->lastVersion;
64
    }
65
66 4
67
    /**
68 4
     * @return string
69
     */
70
    public static function getName(): string
71
    {
72
        return self::EVENT_NAME;
73
    }
74
}