AbstractContactPointUpdated   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getContactPoint() 0 4 1
A serialize() 0 6 1
A deserialize() 0 4 1
1
<?php
2
3
namespace CultuurNet\UDB3\Offer\Events;
4
5
use CultuurNet\UDB3\ContactPoint;
6
7
abstract class AbstractContactPointUpdated extends AbstractEvent
8
{
9
    /**
10
     * @var ContactPoint
11
     */
12
    protected $contactPoint;
13
14
    final public function __construct(string $id, ContactPoint $contactPoint)
15
    {
16
        parent::__construct($id);
17
        $this->contactPoint = $contactPoint;
18
    }
19
20
    public function getContactPoint(): ContactPoint
21
    {
22
        return $this->contactPoint;
23
    }
24
25
    public function serialize(): array
26
    {
27
        return parent::serialize() + array(
28
            'contactPoint' => $this->contactPoint->serialize(),
29
        );
30
    }
31
32
    public static function deserialize(array $data): AbstractContactPointUpdated
33
    {
34
        return new static($data['item_id'], ContactPoint::deserialize($data['contactPoint']));
35
    }
36
}
37