ContactPointUpdated::deserialize()   A
last analyzed

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 1
1
<?php
2
3
namespace CultuurNet\UDB3\Organizer\Events;
4
5
use CultuurNet\UDB3\ContactPoint;
6
7 View Code Duplication
final class ContactPointUpdated extends OrganizerEvent
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...
8
{
9
    /**
10
     * @var ContactPoint
11
     */
12
    private $contactPoint;
13
14
    public function __construct(
15
        string $organizerId,
16
        ContactPoint $contactPoint
17
    ) {
18
        parent::__construct($organizerId);
19
        $this->contactPoint = $contactPoint;
20
    }
21
22
    public function getContactPoint(): ContactPoint
23
    {
24
        return $this->contactPoint;
25
    }
26
27
    public function serialize(): array
28
    {
29
        return parent::serialize() + [
30
            'contactPoint' => $this->contactPoint->serialize(),
31
        ];
32
    }
33
34
    public static function deserialize(array $data): ContactPointUpdated
35
    {
36
        return new static(
37
            $data['organizer_id'],
38
            ContactPoint::deserialize($data['contactPoint'])
39
        );
40
    }
41
}
42