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

CommentCreatedPostsIEvent::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\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
     * @param array $data
18
     */
19
    public function __construct(array $data)
20 3
    {
21
        parent::__construct( $data);
22 3
        $this->postId = $this->ulid('postId');
23 3
        $this->comments = [$this->array('comment')];
24 3
    }
25 3
26
27
    /**
28
     * @return Ulid|null
29
     */
30
    public function getPostId(): ?Ulid
31 2
    {
32
        return $this->postId;
33 2
    }
34
35
    /**
36
     * @return array
37
     */
38
    public function getComments(): array
39 2
    {
40
        return $this->comments;
41 2
    }
42
43
    /**
44 1
     * @return string
45
     */
46
    public static function getName(): string
47
    {
48
        return self::EVENT_NAME;
49
    }
50
51
}