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

EntryTransactionDetail   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 25%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
c 1
b 0
f 1
lcom 0
cbo 6
dl 0
loc 28
ccs 3
cts 12
cp 0.25
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getRelatedPartyAccount() 0 22 6
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