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

PostCreatedCommentsIEvent::getName()   A

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 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
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 PostCreatedCommentsIEvent extends ApplicationInboundEvent
9
{
10
    const EVENT_NAME = "POST_CREATED";
11
12
    private Ulid $id;
13
14
    private string $title;
15
16
    private array $tags;
17
18
    /**
19
     * @param array $data
20
     */
21
    public function __construct(array $data)
22
    {
23
        parent::__construct($data);
24
        $this->id = $this->ulid('id');
25
        $this->title = $this->string('title');
26
        $this->tags = $this->array('tags');
27
    }
28
29 12
    /**
30
     * @return Ulid
31 12
     */
32 12
    public function getId(): Ulid
33 12
    {
34 12
        return $this->id;
35 12
    }
36 12
37 12
    /**
38 12
     * @return string
39 12
     */
40
    public function getTitle(): string
41
    {
42
        return $this->title;
43
    }
44
45 11
    /**
46
     * @return array
47 11
     */
48
    public function getTags(): array
49
    {
50
        return $this->tags;
51
    }
52
53 11
    /**
54
     * @return string
55 11
     */
56
    public static function getName(): string
57
    {
58
        return self::EVENT_NAME;
59
    }
60
61
}