Completed
Push — master ( 70b047...5c79cc )
by Kristof
03:34
created

ConstraintRemoved::serialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace CultuurNet\UDB3\Role\Events;
4
5
use CultuurNet\UDB3\ValueObject\SapiVersion;
6
use ValueObjects\Identity\UUID;
7
8
class ConstraintRemoved extends AbstractEvent
9
{
10
    /**
11
     * @var SapiVersion
12
     */
13
    private $sapiVersion;
14
15
    /**
16
     * @param UUID $uuid
17
     * @param SapiVersion $sapiVersion
18
     */
19
    public function __construct(
20
        UUID $uuid,
21
        SapiVersion $sapiVersion
22
    ) {
23
        parent::__construct($uuid);
24
        $this->sapiVersion = $sapiVersion;
25
    }
26
27
    /**
28
     * @return SapiVersion
29
     */
30
    public function getSapiVersion(): SapiVersion
31
    {
32
        return $this->sapiVersion;
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public static function deserialize(array $data)
39
    {
40
        return new static(
41
            new UUID($data['uuid']),
42
            SapiVersion::fromNative($data['sapiVersion'])
43
        );
44
    }
45
46
    /**
47
     * @inheritdoc
48
     */
49
    public function serialize()
50
    {
51
        return parent::serialize() + array(
52
                'sapiVersion' => $this->sapiVersion->toNative(),
53
            );
54
    }
55
}
56