ActorImportedFromUDB2   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getCdbXml() 0 4 1
A getCdbXmlNamespaceUri() 0 4 1
A serialize() 0 7 1
A deserialize() 0 11 1
1
<?php
2
3
namespace CultuurNet\UDB3\Actor;
4
5
class ActorImportedFromUDB2 extends ActorEvent
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $cdbXml;
11
12
    /**
13
     * @var string
14
     */
15
    protected $cdbXmlNamespaceUri;
16
17
    final public function __construct(string $actorId, string $cdbXml, string $cdbXmlNamespaceUri)
18
    {
19
        parent::__construct($actorId);
20
        $this->cdbXml = $cdbXml;
21
        $this->cdbXmlNamespaceUri = $cdbXmlNamespaceUri;
22
    }
23
24
    public function getCdbXml(): string
25
    {
26
        return $this->cdbXml;
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function getCdbXmlNamespaceUri(): string
33
    {
34
        return $this->cdbXmlNamespaceUri;
35
    }
36
37
    public function serialize(): array
38
    {
39
        return parent::serialize() + array(
40
            'cdbxml' => $this->cdbXml,
41
            'cdbXmlNamespaceUri' => $this->cdbXmlNamespaceUri,
42
        );
43
    }
44
45
    public static function deserialize(array $data): ActorImportedFromUDB2
46
    {
47
        $data += array(
48
            'cdbXmlNamespaceUri' => \CultureFeed_Cdb_Xml::namespaceUriForVersion('3.2'),
49
        );
50
        return new static(
51
            $data['actor_id'],
52
            $data['cdbxml'],
53
            $data['cdbXmlNamespaceUri']
54
        );
55
    }
56
}
57