Completed
Push — master ( 0d5cb2...ca808c )
by Frederik
8s
created

EntryTransactionDetail::getRelatedPartyAccount()   B

Complexity

Conditions 6
Paths 6

Size

Total Lines 22
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 21.1875

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 22
ccs 3
cts 12
cp 0.25
rs 8.6737
cc 6
eloc 11
nc 6
nop 1
crap 21.1875
1
<?php
2
3
namespace Genkgo\Camt\Camt054\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 3
    public function getRelatedPartyAccount(SimpleXMLElement $xmlRelatedPartyTypeAccount)
16
    {
17 3
        if (false === isset($xmlRelatedPartyTypeAccount->Id)) {
18 3
            return;
19
        }
20
21
        if (isset($xmlRelatedPartyTypeAccount->Id->IBAN)) {
22
            return new DTO\IbanAccount(new Iban((string) $xmlRelatedPartyTypeAccount->Id->IBAN));
23
        }
24
25
        if (isset($xmlRelatedPartyTypeAccount->Id->BBAN)) {
26
            return new DTO\BBANAccount((string) $xmlRelatedPartyTypeAccount->Id->BBAN);
27
        }
28
29
        if (isset($xmlRelatedPartyTypeAccount->Id->UPIC)) {
30
            return new DTO\UPICAccount((string) $xmlRelatedPartyTypeAccount->Id->UPIC);
31
        }
32
33
        if (isset($xmlRelatedPartyTypeAccount->Id->PrtryAcct)) {
34
            return new DTO\ProprietaryAccount((string) $xmlRelatedPartyTypeAccount->Id->PrtryAcct->Id);
35
        }
36
    }
37
}
38