RefundCapturedReservation::getRefundAmount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Loevgaard\AltaPay\Response;
3
4
use Loevgaard\AltaPay;
5
use Loevgaard\AltaPay\Entity\ResultTrait;
6
use Loevgaard\AltaPay\Entity\TransactionsTrait;
7
use Money\Money;
8
9
class RefundCapturedReservation extends Response
10
{
11
    use ResultTrait;
12
    use TransactionsTrait;
13
14
    /**
15
     * @var Money
16
     */
17
    protected $refundAmount;
18
19
    /**
20
     * @var int
21
     */
22
    protected $refundCurrency;
23
24
    /**
25
     * @deprecated
26
     * @var string
27
     */
28
    protected $refundResult;
29
30
    /**
31
     * @return Money
32
     */
33 3
    public function getRefundAmount(): Money
34
    {
35 3
        return $this->refundAmount;
36
    }
37
38
    /**
39
     * @return int
40
     */
41 3
    public function getRefundCurrency(): int
42
    {
43 3
        return $this->refundCurrency;
44
    }
45
46
    /**
47
     * @deprecated
48
     * @return string
49
     */
50 3
    public function getRefundResult(): string
51
    {
52 3
        return $this->refundResult;
0 ignored issues
show
Deprecated Code introduced by
The property Loevgaard\AltaPay\Respon...ervation::$refundResult has been deprecated.

This property 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 property will be removed from the class and what other property to use instead.

Loading history...
53
    }
54
55 6 View Code Duplication
    protected function init()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
56
    {
57
        /** @var \SimpleXMLElement $body */
58 6
        $body = $this->xmlDoc->Body;
0 ignored issues
show
Bug introduced by
The property Body 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...
59
60 6
        $currency = (int)$body->RefundCurrency;
61 6
        $alphaCurrency = AltaPay\alphaCurrencyFromNumeric($currency);
62
63 6
        $this->refundAmount = AltaPay\createMoneyFromFloat($alphaCurrency, (float)$body->RefundAmount);
64 6
        $this->refundCurrency = $currency;
65 6
        $this->refundResult = (string)$body->RefundResult;
0 ignored issues
show
Deprecated Code introduced by
The property Loevgaard\AltaPay\Respon...ervation::$refundResult has been deprecated.

This property 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 property will be removed from the class and what other property to use instead.

Loading history...
66 6
        $this->hydrateTransactions($body);
67 6
    }
68
}
69