Passed
Push — main ( dc275a...8e4fcf )
by Slawomir
04:22
created

PostBaselinedCommentsIEvent   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 62
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getVersion() 0 3 1
A __construct() 0 7 1
A getId() 0 3 1
A getTags() 0 3 1
A getName() 0 3 1
A getTitle() 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 PostBaselinedCommentsIEvent extends ApplicationInboundEvent
9
{
10
    const EVENT_NAME = "POST_BASELINED";
11
12
    private Ulid $id;
13
14
    private string $title;
15
16
    private array $tags;
17
18
    private int $version;
19
20
    /**
21
     * @param array $data
22
     */
23
    public function __construct(array $data)
24
    {
25
        parent::__construct($data);
26
        $this->id = $this->ulid('id');
27
        $this->title = $this->string('title');
28
        $this->tags = $this->array('tags');
29
        $this->version = $this->int('version');
30
    }
31
32
    /**
33
     * @return Ulid
34
     */
35
    public function getId(): Ulid
36
    {
37
        return $this->id;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getTitle(): string
44
    {
45
        return $this->title;
46
    }
47
48
    /**
49
     * @return array
50
     */
51
    public function getTags(): array
52
    {
53
        return $this->tags;
54
    }
55
56
    /**
57
     * @return int
58
     */
59
    public function getVersion(): int
60
    {
61
        return $this->version;
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public static function getName(): string
68
    {
69
        return self::EVENT_NAME;
70
    }
71
72
}