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

CommentsBaselinedPostsIEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 40
ccs 10
cts 10
cp 1
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getComments() 0 3 1
A getPostId() 0 3 1
A __construct() 0 5 1
A getName() 0 3 1
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
}