Completed
Pull Request — master (#59)
by
unknown
01:33
created

EntryTransactionDetail::addAmountDetails()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 21
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 5

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 21
ccs 13
cts 13
cp 1
rs 8.7624
cc 5
eloc 12
nc 4
nop 3
crap 5
1
<?php
2
3
namespace Genkgo\Camt\Decoder;
4
5
use Genkgo\Camt\DTO;
6
use \SimpleXMLElement;
7
use Genkgo\Camt\Decoder\Factory\DTO as DTOFactory;
8
use Money\Money;
9
use Money\Currency;
10
use Genkgo\Camt\Util\StringToUnits;
11
12
abstract class EntryTransactionDetail
13
{
14
    /**
15
     * @var DateDecoderInterface
16
     */
17
    private $dateDecoder;
18
19
    /**
20
     * EntryTransactionDetail constructor.
21
     * @param DateDecoderInterface $dateDecoder
22
     */
23 37
    public function __construct(DateDecoderInterface $dateDecoder)
24
    {
25 37
        $this->dateDecoder = $dateDecoder;
26 37
    }
27
28
    /**
29
     * @param DTO\EntryTransactionDetail $detail
30
     * @param SimpleXMLElement           $xmlDetail
31
     */
32 23
    public function addReferences(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail)
33
    {
34 23
        if (false === isset($xmlDetail->Refs)) {
35 8
            return;
36
        }
37
38 18
        $refs = $xmlDetail->Refs;
0 ignored issues
show
Bug introduced by
The property Refs 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...
39 18
        $reference = new DTO\Reference();
40
41 18
        $reference->setMessageId(isset($refs->MsgId) ? (string) $refs->MsgId : null);
42 18
        $reference->setAccountServiceReference(isset($refs->AcctSvcrRef) ? (string) $refs->AcctSvcrRef : null);
43 18
        $reference->setPaymentInformationId(isset($refs->PmtInfId) ? (string) $refs->PmtInfId : null);
44 18
        $reference->setInstructionId(isset($refs->InstrId) ? (string) $refs->InstrId : null);
45 18
        $reference->setEndToEndId(isset($refs->EndToEndId) ? (string) $refs->EndToEndId : null);
46 18
        $reference->setTransactionId(isset($refs->TxId) ? (string) $refs->TxId : null);
47 18
        $reference->setMandateId(isset($refs->MndtId) ? (string) $refs->MndtId : null);
48 18
        $reference->setChequeNumber(isset($refs->ChqNb) ? (string) $refs->ChqNb : null);
49 18
        $reference->setClearingSystemReference(isset($refs->ClrSysRef) ? (string) $refs->ClrSysRef : null);
50 18
        $reference->setAccountOwnerTransactionId(isset($refs->AcctOwnrTxId) ? (string) $refs->AcctOwnrTxId : null);
51 18
        $reference->setAccountServicerTransactionId(isset($refs->AcctSvcrTxId) ? (string) $refs->AcctSvcrTxId : null);
52 18
        $reference->setMarketInfrastructureTransactionId(isset($refs->MktInfrstrctrTxId) ? (string) $refs->MktInfrstrctrTxId : null);
53 18
        $reference->setProcessingId(isset($refs->PrcgId) ? (string) $refs->PrcgId : null);
54
55 18
        foreach ($refs->Prtry as $xmlProprietary) {
56 8
            $type = isset($xmlProprietary->Tp) ? (string) $xmlProprietary->Tp : null;
57 8
            $subReference = isset($xmlProprietary->Ref) ? (string) $xmlProprietary->Ref : null;
58
59 8
            $reference->addProprietary(new DTO\ProprietaryReference($type, $subReference));
60
        }
61
62 18
        $detail->addReference($reference);
63 18
    }
64
65
    /**
66
     * @param DTO\EntryTransactionDetail $detail
67
     * @param SimpleXMLElement           $xmlDetail
68
     */
69 23
    public function addRelatedParties(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail)
70
    {
71 23
        if (false === isset($xmlDetail->RltdPties)) {
72 1
            return;
73
        }
74
75 22
        foreach ($xmlDetail->RltdPties as $xmlRelatedParty) {
76 22
            if (isset($xmlRelatedParty->Cdtr)) {
77 22
                $xmlRelatedPartyType = $xmlRelatedParty->Cdtr;
78 22
                $xmlRelatedPartyTypeAccount = $xmlRelatedParty->CdtrAcct;
79 22
                $xmlRelatedPartyName = (isset($xmlRelatedPartyType->Nm)) ? (string) $xmlRelatedPartyType->Nm : '' ;
80 22
                $relatedPartyType = $creditor = new DTO\Creditor($xmlRelatedPartyName);
0 ignored issues
show
Unused Code introduced by
$creditor is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
81
82 22
                $this->addRelatedParty($detail, $xmlRelatedPartyType, $relatedPartyType, $xmlRelatedPartyTypeAccount);
83
            }
84
85 22
            if (isset($xmlRelatedParty->UltmtCdtr)) {
86 5
                $xmlRelatedPartyType = $xmlRelatedParty->UltmtCdtr;
87 5
                $xmlRelatedPartyName = (isset($xmlRelatedPartyType->Nm)) ? (string) $xmlRelatedPartyType->Nm : '' ;
88 5
                $relatedPartyType = $creditor = new DTO\UltimateCreditor($xmlRelatedPartyName);
0 ignored issues
show
Unused Code introduced by
$creditor is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
89
90 5
                $this->addRelatedParty($detail, $xmlRelatedPartyType, $relatedPartyType);
91
            }
92
93 22
            if (isset($xmlRelatedParty->Dbtr)) {
94 19
                $xmlRelatedPartyType = $xmlRelatedParty->Dbtr;
95 19
                $xmlRelatedPartyTypeAccount = $xmlRelatedParty->DbtrAcct;
96 19
                $xmlRelatedPartyName = (isset($xmlRelatedPartyType->Nm)) ? (string) $xmlRelatedPartyType->Nm : '' ;
97 19
                $relatedPartyType = $debtor = new DTO\Debtor($xmlRelatedPartyName);
0 ignored issues
show
Unused Code introduced by
$debtor is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
98
99 19
                $this->addRelatedParty($detail, $xmlRelatedPartyType, $relatedPartyType, $xmlRelatedPartyTypeAccount);
100
            }
101
102 22
            if (isset($xmlRelatedParty->UltmtDbtr)) {
103 5
                $xmlRelatedPartyType = $xmlRelatedParty->UltmtDbtr;
104 5
                $xmlRelatedPartyName = (isset($xmlRelatedPartyType->Nm)) ? (string) $xmlRelatedPartyType->Nm : '' ;
105 5
                $relatedPartyType = $creditor = new DTO\UltimateDebtor($xmlRelatedPartyName);
0 ignored issues
show
Unused Code introduced by
$creditor is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
106
107 22
                $this->addRelatedParty($detail, $xmlRelatedPartyType, $relatedPartyType);
108
            }
109
        }
110 22
    }
111
112
    /**
113
     * @param DTO\EntryTransactionDetail $detail
114
     * @param $xmlRelatedPartyType
115
     * @param $relatedPartyType
116
     * @param $xmlRelatedPartyTypeAccount
117
     * @return DTO\RelatedParty
118
     */
119 22
    protected function addRelatedParty(DTO\EntryTransactionDetail $detail, $xmlRelatedPartyType, DTO\RelatedPartyTypeInterface $relatedPartyType, $xmlRelatedPartyTypeAccount = null)
120
    {
121 22
        if (isset($xmlRelatedPartyType->PstlAdr)) {
122 22
            $relatedPartyType->setAddress(DTOFactory\Address::createFromXml($xmlRelatedPartyType->PstlAdr));
123
        }
124
125 22
        $relatedParty = new DTO\RelatedParty($relatedPartyType, $this->getRelatedPartyAccount($xmlRelatedPartyTypeAccount));
126
127 22
        $detail->addRelatedParty($relatedParty);
128
129 22
        return $relatedParty;
130
    }
131
132
    /**
133
     * @param DTO\EntryTransactionDetail $detail
134
     * @param SimpleXMLElement           $xmlDetail
135
     */
136 21
    public function addRelatedAgents(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail)
137
    {
138 21
        if (false === isset($xmlDetail->RltdAgts)) {
139 13
            return;
140
        }
141
142 17
        foreach ($xmlDetail->RltdAgts as $xmlRelatedAgent) {
143 17
            if (isset($xmlRelatedAgent->CdtrAgt)) {
144 17
                $agent = new DTO\CreditorAgent((string)$xmlRelatedAgent->CdtrAgt->FinInstnId->Nm, (string)$xmlRelatedAgent->CdtrAgt->FinInstnId->BIC);
145 17
                $relatedAgent =  new DTO\RelatedAgent($agent);
146 17
                $detail->addRelatedAgent($relatedAgent);
147
            }
148
149 17
            if (isset($xmlRelatedAgent->DbtrAgt)) {
150 17
                $agent = new DTO\DebtorAgent((string)$xmlRelatedAgent->DbtrAgt->FinInstnId->Nm, (string)$xmlRelatedAgent->DbtrAgt->FinInstnId->BIC);
151 17
                $relatedAgent =  new DTO\RelatedAgent($agent);
152 17
                $detail->addRelatedAgent($relatedAgent);
153
            }
154
        }
155 17
    }
156
157
    /**
158
     * @param DTO\EntryTransactionDetail $detail
159
     * @param SimpleXMLElement           $xmlDetail
160
     */
161 24
    public function addRemittanceInformation(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail)
162
    {
163 24
        if (false === isset($xmlDetail->RmtInf)) {
164 8
            return;
165
        }
166
167 19
        $remittanceInformation = new DTO\RemittanceInformation();
168 19
        $unstructuredBlockExists = false;
169
170
        // Unstructured blocks
171 19
        $xmlDetailsUnstructuredBlocks = $xmlDetail->RmtInf->Ustrd;
172 19
        if($xmlDetailsUnstructuredBlocks) {
173 10
            foreach($xmlDetailsUnstructuredBlocks as $xmlDetailsUnstructuredBlock) {
174 10
                $unstructuredRemittanceInformation = new DTO\UnstructuredRemittanceInformation(
175 10
                    (string)$xmlDetailsUnstructuredBlock
176
                );
177
178 10
                $remittanceInformation->addUnstructuredBlock($unstructuredRemittanceInformation);
179
180
                // Legacy : use the very first unstructured block
181 10
                if($remittanceInformation->getMessage() === null ) {
0 ignored issues
show
Deprecated Code introduced by
The method Genkgo\Camt\DTO\Remittan...formation::getMessage() has been deprecated with message: Use getStructuredBlocks method instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
182 10
                    $unstructuredBlockExists = true;
183 10
                    $remittanceInformation->setMessage(
0 ignored issues
show
Deprecated Code introduced by
The method Genkgo\Camt\DTO\Remittan...formation::setMessage() has been deprecated with message: Use addStructuredBlock method instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
184 10
                        (string)$xmlDetailsUnstructuredBlock
185
                    );
186
                }
187
            }
188
        }
189
190
        // Strutcured blocks
191 19
        $xmlDetailsStructuredBlocks = $xmlDetail->RmtInf->Strd;
192 19
        if($xmlDetailsStructuredBlocks) {
193 13
            foreach($xmlDetailsStructuredBlocks as $xmlDetailsStructuredBlock) {
194 13
                $structuredRemittanceInformation = new DTO\StructuredRemittanceInformation();
195
196 13
                if(isset($xmlDetailsStructuredBlock->AddtlRmtInf)) {
197 4
                    $structuredRemittanceInformation->setAdditionalRemittanceInformation(
198 4
                        (string)$xmlDetailsStructuredBlock->AddtlRmtInf
199
                    );
200
                }
201
202 13
                if(isset($xmlDetailsStructuredBlock->CdtrRefInf)) {
203 13
                    $creditorReferenceInformation = new DTO\CreditorReferenceInformation();
204
205 13
                    if(isset($xmlDetailsStructuredBlock->CdtrRefInf->Ref)) {
206 13
                        $creditorReferenceInformation->setRef(
207 13
                            (string)$xmlDetailsStructuredBlock->CdtrRefInf->Ref
208
                        );
209
                    }
210
211 13
                    if(isset($xmlDetailsStructuredBlock->CdtrRefInf->Tp)
212 13
                            && isset($xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry)
213 13
                            && isset($xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry->Prtry)) {
214 4
                        $creditorReferenceInformation->setProprietary(
215 4
                            (string)$xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry->Prtry
216
                        );
217
                    }
218
219 13
                    if(isset($xmlDetailsStructuredBlock->CdtrRefInf->Tp)
220 13
                            && isset($xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry)
221 13
                            && isset($xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry->Cd)) {
222 12
                        $creditorReferenceInformation->setCode(
223 12
                            (string)$xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry->Cd
224
                        );
225
                    }
226
227 13
                    $structuredRemittanceInformation->setCreditorReferenceInformation($creditorReferenceInformation);
228
229
                    // Legacy : do not overwrite message if already defined above
230
                    // and no creditor reference is already defined
231 13
                    if(false === $unstructuredBlockExists
232 13
                            && $remittanceInformation->getCreditorReferenceInformation() === null) {
233 13
                        $remittanceInformation->setCreditorReferenceInformation($creditorReferenceInformation);
234
                    }
235
                }
236
237 13
                $remittanceInformation->addStructuredBlock($structuredRemittanceInformation);
238
            }
239
        }
240
241 19
        $detail->setRemittanceInformation($remittanceInformation);
242 19
    }
243
244
    /**
245
     * @param DTO\EntryTransactionDetail $detail
246
     * @param SimpleXMLElement           $xmlDetail
247
     */
248 23
    public function addRelatedDates(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail)
249
    {
250 23
        if (false === isset($xmlDetail->RltdDts)) {
251 22
            return;
252
        }
253
254 1
        if (isset($xmlDetail->RltdDts->AccptncDtTm)) {
255 1
            $RelatedDates = DTO\RelatedDates::fromUnstructured(
256 1
                $this->dateDecoder->decode((string) $xmlDetail->RltdDts->AccptncDtTm )
257
            );
258 1
            $detail->setRelatedDates($RelatedDates);
259 1
            return;
260
        }
261
    }
262
263
    /**
264
     * @param DTO\EntryTransactionDetail $detail
265
     * @param SimpleXMLElement           $xmlDetail
266
     */
267 23
    public function addReturnInformation(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail)
268
    {
269 23
        if (isset($xmlDetail->RtrInf) && isset($xmlDetail->RtrInf->Rsn->Cd)) {
270 1
            $remittanceInformation = DTO\ReturnInformation::fromUnstructured(
271 1
                (string)$xmlDetail->RtrInf->Rsn->Cd,
272 1
                (string)$xmlDetail->RtrInf->AddtlInf
273
            );
274 1
            $detail->setReturnInformation($remittanceInformation);
275
        }
276 23
    }
277
278
    /**
279
     * @param DTO\EntryTransactionDetail $detail
280
     * @param SimpleXMLElement           $xmlDetail
281
     */
282 23
    public function addAdditionalTransactionInformation(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail)
283
    {
284 23
        if (isset($xmlDetail->AddtlTxInf)) {
285 1
            $additionalInformation = new DTO\AdditionalTransactionInformation(
286 1
                (string) $xmlDetail->AddtlTxInf
287
            );
288 1
            $detail->setAdditionalTransactionInformation($additionalInformation);
289
        }
290 23
    }
291
292
    /**
293
     * @param DTO\EntryTransactionDetail $detail
294
     * @param SimpleXMLElement           $xmlDetail
295
     */
296 21
    public function addBankTransactionCode(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail)
297
    {
298 21
        $bankTransactionCode = new DTO\BankTransactionCode();
299
300 21
        if (isset($xmlDetail->BkTxCd)) {
301 19
            $bankTransactionCode = new DTO\BankTransactionCode();
302
303 19
            if (isset($xmlDetail->BkTxCd->Prtry)) {
304 19
                $proprietaryBankTransactionCode = new DTO\ProprietaryBankTransactionCode(
305 19
                    (string)$xmlDetail->BkTxCd->Prtry->Cd,
306 19
                    (string)$xmlDetail->BkTxCd->Prtry->Issr
307
                );
308
309 19
                $bankTransactionCode->setProprietary($proprietaryBankTransactionCode);
310
            }
311
312 19
            if (isset($xmlDetail->BkTxCd->Domn)) {
313 7
                $domainBankTransactionCode = new DTO\DomainBankTransactionCode(
314 7
                    (string)$xmlDetail->BkTxCd->Domn->Cd
315
                );
316
317 7
                if (isset($xmlDetail->BkTxCd->Domn->Fmly)) {
318 7
                    $domainFamilyBankTransactionCode = new DTO\DomainFamilyBankTransactionCode(
319 7
                        (string)$xmlDetail->BkTxCd->Domn->Fmly->Cd,
320 7
                        (string)$xmlDetail->BkTxCd->Domn->Fmly->SubFmlyCd
321
                    );
322
323 7
                    $domainBankTransactionCode->setFamily($domainFamilyBankTransactionCode);
324
                }
325
326 7
                $bankTransactionCode->setDomain($domainBankTransactionCode);
327
            }
328
        }
329
330 21
        $detail->setBankTransactionCode($bankTransactionCode);
331 21
    }
332
333
    /**
334
     * @param DTO\EntryTransactionDetail $detail
335
     * @param SimpleXMLElement           $xmlDetail
336
     */
337 23
    public function addCharges(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail)
338
    {
339 23
            if (isset($xmlDetail->Chrgs)) {
340 4
                $charges = new DTO\Charges();
341
342 4
                if (isset($xmlDetail->Chrgs->TtlChrgsAndTaxAmt) && (string) $xmlDetail->Chrgs->TtlChrgsAndTaxAmt) {
343 4
                    $amount      = StringToUnits::convert((string) $xmlDetail->Chrgs->TtlChrgsAndTaxAmt);
344 4
                    $currency    = (string)$xmlDetail->Chrgs->TtlChrgsAndTaxAmt['Ccy'];
345
346 4
                    $charges->setTotalChargesAndTaxAmount(new Money($amount, new Currency($currency)));
347
                }
348
349 4
                $chargesRecords = $xmlDetail->Chrgs->Rcrd;
350 4
                if ($chargesRecords) {
351 4
                    foreach ($chargesRecords as $chargesRecord) {
352
353 4
                        $chargesDetail = new DTO\ChargesRecord();
354
355 4
                        if(isset($chargesRecord->Amt) && (string) $chargesRecord->Amt) {
356 4
                            $amount      = StringToUnits::convert((string) $chargesRecord->Amt);
357 4
                            $currency    = (string)$chargesRecord->Amt['Ccy'];
358
359 4
                            if ((string) $chargesRecord->CdtDbtInd === 'DBIT') {
360 4
                                $amount = $amount * -1;
361
                            }
362
363 4
                            $chargesDetail->setAmount(new Money($amount, new Currency($currency)));
364
                        }
365 4
                        if (isset($chargesRecord->CdtDbtInd) && (string) $chargesRecord->CdtDbtInd === 'true') {
366
                            $chargesDetail->setChargesIncluded­Indicator(true);
367
                        }
368 4
                        if (isset($chargesRecord->Tp->Prtry->Id) && (string) $chargesRecord->Tp->Prtry->Id) {
369 4
                            $chargesDetail->setIdentification((string) $chargesRecord->Tp->Prtry->Id);
370
                        }
371 4
                        $charges->addRecord($chargesDetail);
372
                    }
373
                }
374 4
                $detail->setCharges($charges);
375
            }
376 23
    }
377
378
    /**
379
     * @param DTO\EntryTransactionDetail $detail
380
     * @param SimpleXMLElement           $xmlDetail
381
     * @param SimpleXMLElement           $CdtDbtInd
382
     */
383 21
    public function addAmountDetails(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail, $CdtDbtInd)
384
    {
385 21
        if (isset($xmlDetail->AmtDtls)) {
386 7
            $amountDetails = new DTO\AmountDetails();
387
388 7
            if (isset($xmlDetail->AmtDtls->TxAmt) && isset($xmlDetail->AmtDtls->TxAmt->Amt)) {
389 7
                $amount = StringToUnits::convert((string) $xmlDetail->AmtDtls->TxAmt->Amt);
390
391 7
                if ((string) $CdtDbtInd === 'DBIT') {
392 7
                    $amount = $amount * -1;
393
                }
394
395 7
                $money = new Money(
396 7
                    $amount,
397 7
                    new Currency((string) $xmlDetail->AmtDtls->TxAmt->Amt['Ccy'])
398
                );
399 7
                $amountDetails->setAmount($money);
400
            }
401 7
            $detail->setAmountDetails($amountDetails);
402
        }
403 21
    }
404
405
    /**
406
     * @param DTO\EntryTransactionDetail $detail
407
     * @param SimpleXMLElement           $xmlDetail
408
     * @param SimpleXMLElement           $CdtDbtInd
409
     */
410 21
    public function addAmount(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail, $CdtDbtInd)
411
    {
412 21
        if (isset($xmlDetail->Amt)) {
413 14
            $amountDetails = new DTO\Amount();
414
415 14
                $amount = StringToUnits::convert((string) $xmlDetail->Amt);
416
417 14
                if ((string) $CdtDbtInd === 'DBIT') {
418 7
                    $amount = $amount * -1;
419
                }
420
421 14
                $money = new Money(
422 14
                    $amount,
423 14
                    new Currency((string) $xmlDetail->Amt['Ccy'])
424
                );
425 14
                $amountDetails->setAmount($money);
426
427 14
            $detail->setAmount($amountDetails);
428
        }
429 21
    }
430
431
    /**
432
     * @param SimpleXMLElement $xmlDetail
0 ignored issues
show
Bug introduced by
There is no parameter named $xmlDetail. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
433
     *
434
     * @return DTO\Account|null
435
     */
436
    abstract public function getRelatedPartyAccount(SimpleXMLElement $xmlRelatedPartyTypeAccount = null);
437
}
438