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

CommentsBaselinedPostsIEvent::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 CommentsBaselinedPostsIEvent extends ApplicationInboundEvent
9
{
10
    const EVENT_NAME = "COMMENTS_BASELINED";
11
12
    private Ulid $postId;
13
14
    private array $comments;
15
16
    /**
17
     * @param array $data
18
     */
19 2
    public function __construct(array $data)
20
    {
21 2
        parent::__construct($data);
22 2
        $this->postId = $this->ulid('postId');
23 2
        $this->comments = $this->array('comments');
24 2
    }
25
26
    /**
27
     * @return Ulid|null
28
     */
29 1
    public function getPostId(): ?Ulid
30
    {
31 1
        return $this->postId;
32
    }
33
34
    /**
35
     * @return array
36
     */
37 1
    public function getComments(): array
38
    {
39 1
        return $this->comments;
40
    }
41
42
    /**
43 1
     * @return string
44
     */
45
    public static function getName(): string
46
    {
47
        return self::EVENT_NAME;
48
    }
49
50
51
}