Completed
Push — master ( a17ed1...ce9e82 )
by Yann
7s
created

Recipient   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 90.91%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 27
ccs 10
cts 11
cp 0.9091
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B createFromXml() 0 19 5
1
<?php
2
3
namespace Genkgo\Camt\Decoder\Factory\DTO;
4
5
use SimpleXMLElement;
6
use Genkgo\Camt\DTO;
7
8
class Recipient
9
{
10
    /**
11
     * @param SimpleXMLElement $xmlRecipient
12
     *
13
     * @return DTO\Recipient
14
     */
15 16
    public static function createFromXml(SimpleXMLElement $xmlRecipient)
16
    {
17 16
        $recipient = new DTO\Recipient();
18
19 16
        if (isset($xmlRecipient->Nm)) {
20 16
            $recipient->setName((string) $xmlRecipient->Nm);
21
        }
22 16
        if (isset($xmlRecipient->PstlAdr)) {
23 16
            $recipient->setAddress(Address::createFromXml($xmlRecipient->PstlAdr));
24
        }
25 16
        if (isset($xmlRecipient->CtryOfRes)) {
26 16
            $recipient->setCountryOfResidence((string) $xmlRecipient->CtryOfRes);
27
        }
28 16
        if (isset($xmlRecipient->CtctDtls)) {
29
            $recipient->setContactDetails(ContactDetails::createFromXml($xmlRecipient->CtctDtls));
30
        }
31
32 16
        return $recipient;
33
    }
34
}
35