AbstractLabelEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 35
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getLabelId() 0 4 1
A deserialize() 0 7 1
A serialize() 0 4 1
1
<?php
2
3
namespace CultuurNet\UDB3\Role\Events;
4
5
use ValueObjects\Identity\UUID;
6
7
abstract class AbstractLabelEvent extends AbstractEvent
8
{
9
    public const LABEL_ID = 'labelId';
10
11
    /**
12
     * @var UUID
13
     */
14
    private $labelId;
15
16
    final public function __construct(
17
        UUID $uuid,
18
        UUID $labelId
19
    ) {
20
        parent::__construct($uuid);
21
        $this->labelId = $labelId;
22
    }
23
24
    public function getLabelId(): UUID
25
    {
26
        return $this->labelId;
27
    }
28
29
    public static function deserialize(array $data): AbstractLabelEvent
30
    {
31
        return new static(
32
            new UUID($data[self::UUID]),
33
            new UUID($data[self::LABEL_ID])
34
        );
35
    }
36
37
    public function serialize(): array
38
    {
39
        return parent::serialize() + [self::LABEL_ID => $this->getLabelId()->toNative()];
40
    }
41
}
42