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

OrganisationIdentification   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 81.82%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 8
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 57
ccs 36
cts 44
cp 0.8182
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C createFromXml() 0 52 8
1
<?php
2
3
namespace Genkgo\Camt\Decoder\Factory\DTO;
4
5
use SimpleXMLElement;
6
use Genkgo\Camt\DTO;
7
8
class OrganisationIdentification
9
{
10
    use Behavior\Mapping;
11
12 17
    public static function createFromXml(SimpleXMLElement $xmlOrganisationIdentification)
13
    {
14
        $mapping = [
15 17
            ['setBic', 'BIC'],
16 17
            ['setBic', 'BICOrBEI'],
17 17
            ['setBic', 'AnyBIC'],
18 17
            ['setBei', 'BICOrBEI'],
19 17
            ['setIbei', 'IBEI'],
20 17
            ['setBei', 'BEI'],
21 17
            ['setEangln', 'EANGLN'],
22 17
            ['setChipsUniversalId', 'USCHU'],
23 17
            ['setDuns', 'DUNS'],
24 17
            ['setBankPartyId', 'BkPtyId'],
25 17
            ['setTaxId', 'TaxIdNb'],
26 17
        ];
27
28 17
        $organisationIdentification = new DTO\OrganisationIdentification();
29
30 17
        self::map($organisationIdentification, $xmlOrganisationIdentification, $mapping);
31
32 17
        if (isset($xmlOrganisationIdentification->PrtryId)) {
33 4
            $other = $xmlOrganisationIdentification->PrtryId;
0 ignored issues
show
Bug introduced by
The property PrtryId does not seem to exist in SimpleXMLElement.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
34 4
        }
35 17
        if (isset($xmlOrganisationIdentification->Othr)) {
36 16
            $other = $xmlOrganisationIdentification->Othr;
0 ignored issues
show
Bug introduced by
The property Othr does not seem to exist in SimpleXMLElement.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
37 16
        }
38
39 17
        if (isset($other)) {
40 17
            if (isset($other->Id)) {
41 17
                $organisationIdentification->setOtherId(
42 17
                    (string) $other->Id
43 17
                );
44 17
            }
45 17
            if (isset($other->Issr)) {
46 17
                $organisationIdentification->setOtherIssuer(
47 17
                    (string) $other->Issr
48 17
                );
49 17
            }
50 17
            if (isset($other->Tp)) {
51
                $organisationIdentification->setOtherType(
52
                    (string) $other->Tp
53
                );
54
            }
55 17
            if (isset($other->SchmeNm)) {
56
                $organisationIdentification->setOtherSchemeName(
57
                    (string) $other->SchmeNm
58
                );
59
            }
60 17
        }
61
62 17
        return $organisationIdentification;
63
    }
64
}
65