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

PostCreatedCommentsIEvent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 51
ccs 14
cts 14
cp 1
rs 10
c 1
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getTitle() 0 3 1
A getTags() 0 3 1
A getId() 0 3 1
A __construct() 0 6 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 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
}