Completed
Pull Request — master (#27)
by Yann
02:57
created

PersonIdentification   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 10
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 53
ccs 0
cts 42
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C createFromXml() 0 48 10
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)
0 ignored issues
show
Unused Code introduced by
The parameter $xmlPersonIdentification is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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);
0 ignored issues
show
Bug introduced by
The variable $personIdentification does not exist. Did you mean $xmlPersonIdentification?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
27
28
        if (isset($xmlPersonIdentification->DtAndPlcOfBirth)) {
29
            $xml = $xmlPersonIdentification->DtAndPlcOfBirth;
30
31
            if (isset($xml->BirthDt)) {
32
                $personIdentification->setBirthDate(new DateTimeImmutable((string) $xml->BirthDt));
0 ignored issues
show
Bug introduced by
The variable $personIdentification does not exist. Did you mean $xmlPersonIdentification?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
33
            }
34
            if (isset($xml->PrvcOfBirth)) {
35
                $personIdentification->setProvinceOfBirth((string) $xml->PrvcOfBirth);
0 ignored issues
show
Bug introduced by
The variable $personIdentification does not exist. Did you mean $xmlPersonIdentification?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
36
            }
37
            if (isset($xml->CityOfBirth)) {
38
                $personIdentification->setCityOfBirth((string) $xml->CityOfBirth);
0 ignored issues
show
Bug introduced by
The variable $personIdentification does not exist. Did you mean $xmlPersonIdentification?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
39
            }
40
            if (isset($xml->CtryOfBirth)) {
41
                $personIdentification->setCountryOfBirth((string) $xml->CtryOfBirth);
0 ignored issues
show
Bug introduced by
The variable $personIdentification does not exist. Did you mean $xmlPersonIdentification?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
42
            }
43
        }
44
45
        if (isset($xmlPersonIdentification->OthrId)) {
46
            if (isset($xmlPersonIdentification->OthrId->Id)) {
47
                $personIdentification->setOtherIdentification((string) $xmlPersonIdentification->OthrId->Id);
0 ignored issues
show
Bug introduced by
The variable $personIdentification does not exist. Did you mean $xmlPersonIdentification?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
48
            }
49
            if (isset($xmlPersonIdentification->OthrId->IdTp)) {
50
                $personIdentification->setOtherIdentificationType((string) $xmlPersonIdentification->OthrId->IdTp);
0 ignored issues
show
Bug introduced by
The variable $personIdentification does not exist. Did you mean $xmlPersonIdentification?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
51
            }
52
            if (isset($xmlPersonIdentification->OthrId->SchmeNm)) {
53
                $personIdentification->setOtherIdentificationSc((string) $xmlPersonIdentification->OthrId->IdTp);
0 ignored issues
show
Bug introduced by
The variable $personIdentification does not exist. Did you mean $xmlPersonIdentification?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
54
            }
55
        }
56
57
        return $personIdentification;
0 ignored issues
show
Bug introduced by
The variable $personIdentification does not exist. Did you mean $xmlPersonIdentification?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
58
    }
59
}
60