Conditions | 8 |
Paths | 80 |
Total Lines | 27 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 8.125 |
Changes | 2 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
15 | 18 | public static function createFromXml(SimpleXMLElement $xmlRecipient) |
|
16 | { |
||
17 | 18 | $recipient = new DTO\Recipient(); |
|
18 | |||
19 | 18 | if (isset($xmlRecipient->Nm)) { |
|
20 | 18 | $recipient->setName((string) $xmlRecipient->Nm); |
|
21 | } |
||
22 | 18 | if (isset($xmlRecipient->PstlAdr)) { |
|
23 | 18 | $recipient->setAddress(Address::createFromXml($xmlRecipient->PstlAdr)); |
|
24 | } |
||
25 | 18 | if (isset($xmlRecipient->CtryOfRes)) { |
|
26 | 18 | $recipient->setCountryOfResidence((string) $xmlRecipient->CtryOfRes); |
|
27 | } |
||
28 | 18 | if (isset($xmlRecipient->CtctDtls)) { |
|
29 | $recipient->setContactDetails(ContactDetails::createFromXml($xmlRecipient->CtctDtls)); |
||
30 | } |
||
31 | 18 | if (isset($xmlRecipient->Id)) { |
|
32 | 18 | if (isset($xmlRecipient->Id->OrgId)) { |
|
33 | 18 | $recipient->setIdentification(OrganisationIdentification::createFromXml($xmlRecipient->Id->OrgId)); |
|
34 | } |
||
35 | 18 | if (isset($xmlRecipient->Id->PrvtId)) { |
|
36 | $recipient->setIdentification(PersonIdentification::createFromXml($xmlRecipient->Id->PrvtId)); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | 18 | return $recipient; |
|
41 | } |
||
42 | } |
||
43 |