Recipient   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 92.86%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 25
ccs 13
cts 14
cp 0.9286
rs 10
c 1
b 0
f 0
wmc 7

1 Method

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