1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Genkgo\Camt\Decoder\Factory\DTO; |
4
|
|
|
|
5
|
|
|
use DateTimeImmutable; |
6
|
|
|
|
7
|
|
|
class PersonIdentification |
8
|
|
|
{ |
9
|
|
|
use Behavior\Mapping; |
10
|
|
|
|
11
|
|
|
public static function createFromXml(SimpleXMLElement $xmlPersonIdentification) |
|
|
|
|
12
|
|
|
{ |
13
|
|
|
$xmlPersonIdentification = new DTO\PersonIdentification(); |
14
|
|
|
|
15
|
|
|
$mapping = [ |
16
|
|
|
['setDriversLicenseNumber', 'DrvrsLicNb'], |
17
|
|
|
['setCustomerNumber', 'CstmrNb'], |
18
|
|
|
['setSocialSecurityNumber', 'SclSctyNb'], |
19
|
|
|
['setAlienRegistrationNumber', 'AlnRegnNb'], |
20
|
|
|
['setPassportNumber', 'PsptNb'], |
21
|
|
|
['setTaxId', 'TaxIdNb'], |
22
|
|
|
['setIdCardNumber', 'IdntyCardNb'], |
23
|
|
|
['setEmployerId', 'MplyrIdNb'], |
24
|
|
|
]; |
25
|
|
|
|
26
|
|
|
self::map($personIdentification, $xmlPersonIdentification, $mapping); |
|
|
|
|
27
|
|
|
|
28
|
|
|
if (isset($xmlPersonIdentification->DtAndPlcOfBirth)) { |
29
|
|
|
$xml = $xmlPersonIdentification->DtAndPlcOfBirth; |
30
|
|
|
|
31
|
|
|
if (isset($xml->BirthDt)) { |
32
|
|
|
$personIdentification->setBirthDate(new DateTimeImmutable((string) $xml->BirthDt)); |
|
|
|
|
33
|
|
|
} |
34
|
|
|
if (isset($xml->PrvcOfBirth)) { |
35
|
|
|
$personIdentification->setProvinceOfBirth((string) $xml->PrvcOfBirth); |
|
|
|
|
36
|
|
|
} |
37
|
|
|
if (isset($xml->CityOfBirth)) { |
38
|
|
|
$personIdentification->setCityOfBirth((string) $xml->CityOfBirth); |
|
|
|
|
39
|
|
|
} |
40
|
|
|
if (isset($xml->CtryOfBirth)) { |
41
|
|
|
$personIdentification->setCountryOfBirth((string) $xml->CtryOfBirth); |
|
|
|
|
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
if (isset($xmlPersonIdentification->OthrId)) { |
46
|
|
|
if (isset($xmlPersonIdentification->OthrId->Id)) { |
47
|
|
|
$personIdentification->setOtherIdentification((string) $xmlPersonIdentification->OthrId->Id); |
|
|
|
|
48
|
|
|
} |
49
|
|
|
if (isset($xmlPersonIdentification->OthrId->IdTp)) { |
50
|
|
|
$personIdentification->setOtherIdentificationType((string) $xmlPersonIdentification->OthrId->IdTp); |
|
|
|
|
51
|
|
|
} |
52
|
|
|
if (isset($xmlPersonIdentification->OthrId->SchmeNm)) { |
53
|
|
|
$personIdentification->setOtherIdentificationSc((string) $xmlPersonIdentification->OthrId->IdTp); |
|
|
|
|
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
return $personIdentification; |
|
|
|
|
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.