Test Setup Failed
Push — main ( abdcb9...2e5f68 )
by Slawomir
04:37
created

CommentCreatedPostsIEvent::getComments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App\Modules\Posts\Api\Event\Inbound;
4
5
use App\Infrastructure\Events\ApplicationInboundEvent;
6
use Symfony\Component\Uid\Ulid;
7
8
class CommentCreatedPostsIEvent extends ApplicationInboundEvent
9
{
10
    const EVENT_NAME = "COMMENT_CREATED";
11
12
    private Ulid $postId;
13
14
    private array $comments;
15
16
17
    /**
18
     * @param array $data
19
     */
20
    public function __construct(array $data)
21
    {
22
        parent::__construct(self::EVENT_NAME, $data);
23
        $this->postId = $this->ulid('postId');
24
        $this->comments = [$this->array('comment')];
25
    }
26
27
28
    /**
29
     * @return Ulid|null
30
     */
31
    public function getPostId(): ?Ulid
32
    {
33
        return $this->postId;
34
    }
35
36
    /**
37
     * @return array
38
     */
39
    public function getComments(): array
40
    {
41
        return $this->comments;
42
    }
43
44
}