Completed
Pull Request — master (#32)
by
unknown
04:50
created

EntryTransactionDetail   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Test Coverage

Coverage 56.52%

Importance

Changes 3
Bugs 1 Features 3
Metric Value
wmc 11
c 3
b 1
f 3
lcom 0
cbo 7
dl 0
loc 49
ccs 13
cts 23
cp 0.5652
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C getRelatedPartyAccount() 0 43 11
1
<?php
2
3
namespace Genkgo\Camt\Camt052\Decoder;
4
5
use Genkgo\Camt\DTO;
6
use Genkgo\Camt\Decoder\EntryTransactionDetail as BaseDecoder;
7
use \SimpleXMLElement;
8
use Genkgo\Camt\Iban;
9
10
class EntryTransactionDetail extends BaseDecoder
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 4
    public function getRelatedPartyAccount(SimpleXMLElement $xmlRelatedPartyTypeAccount)
16
    {
17 4
        if (false === isset($xmlRelatedPartyTypeAccount->Id)) {
18
            return;
19
        }
20
21 4
        if (isset($xmlRelatedPartyTypeAccount->Id->IBAN)) {
22 3
            return new DTO\IbanAccount(new Iban((string) $xmlRelatedPartyTypeAccount->Id->IBAN));
23
        }
24
25 1
        if (isset($xmlRelatedPartyTypeAccount->Id->BBAN)) {
26
            return new DTO\BBANAccount((string) $xmlRelatedPartyTypeAccount->Id->BBAN);
27
        }
28
29 1
        if (isset($xmlRelatedPartyTypeAccount->Id->UPIC)) {
30
            return new DTO\UPICAccount((string) $xmlRelatedPartyTypeAccount->Id->UPIC);
31
        }
32
33 1
        if (isset($xmlRelatedPartyTypeAccount->Id->PrtryAcct)) {
34
            return new DTO\ProprietaryAccount((string) $xmlRelatedPartyTypeAccount->Id->PrtryAcct->Id);
35
        }
36
37 1
        if (isset($xmlRelatedPartyTypeAccount->Id->Othr)) {
38 1
            $xmlOtherIdentification = $xmlRelatedPartyTypeAccount->Id->Othr;
39 1
            $otherAccount = new DTO\OtherAccount((string) $xmlOtherIdentification->Id);
40
41 1
            if (isset($xmlOtherIdentification->SchmeNm)) {
42
                if (isset($xmlOtherIdentification->SchmeNm->Cd)) {
43
                    $otherAccount->setSchemeName((string) $xmlOtherIdentification->SchmeNm->Cd);
44
                }
45
46
                if (isset($xmlOtherIdentification->SchmeNm->Prtry)) {
47
                    $otherAccount->setSchemeName((string) $xmlOtherIdentification->SchmeNm->Prtry);
48
                }
49
            }
50
51 1
            if (isset($xmlOtherIdentification->Issr)) {
52
                $otherAccount->setIssuer($xmlOtherIdentification->Issr);
53
            }
54
55 1
            return $otherAccount;
56
        }
57
    }
58
}
59