Completed
Pull Request — master (#239)
by Luc
04:56
created

LabelDetailsProjectedToJSONLD   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getUuid() 0 4 1
A deserialize() 0 6 1
A serialize() 0 6 1
1
<?php
2
3
namespace CultuurNet\UDB3\Label\Events;
4
5
use Broadway\Serializer\SerializableInterface;
6
use ValueObjects\Identity\UUID;
7
8
class LabelDetailsProjectedToJSONLD implements SerializableInterface
9
{
10
    const UUID = 'uuid';
11
12
    /**
13
     * @var UUID
14
     */
15
    private $uuid;
16
17
    /**
18
     * AbstractEvent constructor.
19
     * @param UUID $uuid
20
     */
21
    public function __construct(UUID $uuid)
22
    {
23
        $this->uuid = $uuid;
24
    }
25
26
    /**
27
     * @return UUID
28
     */
29
    public function getUuid()
30
    {
31
        return $this->uuid;
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public static function deserialize(array $data)
38
    {
39
        return new static(
40
            new UUID($data[self::UUID])
41
        );
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    public function serialize()
48
    {
49
        return [
50
            self::UUID => $this->getUuid()->toNative()
51
        ];
52
    }
53
}
54