LabelDetailsProjectedToJSONLD::getUuid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace CultuurNet\UDB3\Label\Events;
4
5
use Broadway\Serializer\SerializableInterface;
6
use ValueObjects\Identity\UUID;
7
8
final class LabelDetailsProjectedToJSONLD implements SerializableInterface
9
{
10
    public const UUID = 'uuid';
11
12
    /**
13
     * @var UUID
14
     */
15
    private $uuid;
16
17
    public function __construct(UUID $uuid)
18
    {
19
        $this->uuid = $uuid;
20
    }
21
22
    public function getUuid(): UUID
23
    {
24
        return $this->uuid;
25
    }
26
27
    public static function deserialize(array $data): LabelDetailsProjectedToJSONLD
28
    {
29
        return new static(
30
            new UUID($data[self::UUID])
31
        );
32
    }
33
34
    public function serialize(): array
35
    {
36
        return [
37
            self::UUID => $this->getUuid()->toNative(),
38
        ];
39
    }
40
}
41