Completed
Pull Request — master (#397)
by Luc
04:03
created

ConstraintRemoved::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace CultuurNet\UDB3\Role\Events;
4
5
use CultuurNet\UDB3\ValueObject\SapiVersion;
6
use ValueObjects\Identity\UUID;
7
8 View Code Duplication
class ConstraintRemoved extends AbstractEvent
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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