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