PurchaseRedeemHistoryResponseItem   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 170
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 34
dl 0
loc 170
rs 10
c 1
b 0
f 0
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getExecTime() 0 3 1
A getOrderStatus() 0 3 1
A getValue() 0 3 1
A getAmount() 0 3 1
A getLtCode() 0 3 1
A getSerialNo() 0 3 1
A getOrderTime() 0 3 1
A getValueCoin() 0 3 1
A getOrderId() 0 3 1
A getOrderType() 0 3 1
A __construct() 0 13 1
A getFee() 0 3 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Spot\LeverageToken\PurchaseRedeemHistory\Response;
4
5
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
6
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
7
use Carpenstar\ByBitAPI\Spot\LeverageToken\PurchaseRedeemHistory\Interfaces\IPurchaseReedemHistoryResponseItemInterface;
8
9
class PurchaseRedeemHistoryResponseItem extends AbstractResponse implements IPurchaseReedemHistoryResponseItemInterface
10
{
11
    /**
12
     * Actual purchase quantity of the ETP
13
     * @var float $amount
14
     */
15
    private float $amount;
16
17
    /**
18
     * Last update time of the order status
19
     * @var \DateTime $execTime
20
     */
21
    private \DateTime $execTime;
22
23
    /**
24
     * Trading fees
25
     * @var float $fee
26
     */
27
    private float $fee;
28
29
    /**
30
     * Abbreviation of the LT
31
     * @var string $ltCode
32
     */
33
    private string $ltCode;
34
35
    /**
36
     * Order ID
37
     * @var string $orderId
38
     */
39
    private string $orderId;
40
41
    /**
42
     * Order status. 1: Completed; 2: In progress; 3: Failed
43
     * @var int $orderStatus
44
     */
45
    private int $orderStatus;
46
47
    /**
48
     * Order time
49
     * @var \DateTime $orderTime
50
     */
51
    private \DateTime $orderTime;
52
53
    /**
54
     * Order type; 1. Purchase; 2. Redemption
55
     * @var int $orderType
56
     */
57
    private int $orderType;
58
59
    /**
60
     * Serial number
61
     * @var string $serialNo
62
     */
63
    private string $serialNo;
64
65
    /**
66
     * Filled value
67
     * @var float $value
68
     */
69
    private float $value;
70
71
    /**
72
     * Quote asset
73
     * @var string $valueCoin
74
     */
75
    private string $valueCoin;
76
77
78
    public function __construct(array $data)
79
    {
80
        $this->amount = (float) $data['amount'];
81
        $this->execTime = DateTimeHelper::makeFromTimestamp((int) $data['excTime']);
82
        $this->fee = (float) $data['fee'];
83
        $this->ltCode = $data['ltCode'];
84
        $this->orderId = $data['orderId'];
85
        $this->orderStatus = $data['orderStatus'];
86
        $this->orderTime = DateTimeHelper::makeFromTimestamp((int) $data['orderTime']);
87
        $this->orderType = $data['orderType'];
88
        $this->serialNo = $data['serialNo'];
89
        $this->value = (float) $data['value'];
90
        $this->valueCoin = $data['valueCoin'];
91
    }
92
93
    /**
94
     * @return float
95
     */
96
    public function getAmount(): float
97
    {
98
        return $this->amount;
99
    }
100
101
    /**
102
     * @return \DateTime
103
     */
104
    public function getExecTime(): \DateTime
105
    {
106
        return $this->execTime;
107
    }
108
109
    /**
110
     * @return float
111
     */
112
    public function getFee(): float
113
    {
114
        return $this->fee;
115
    }
116
117
    /**
118
     * @return string
119
     */
120
    public function getLtCode(): string
121
    {
122
        return $this->ltCode;
123
    }
124
125
    /**
126
     * @return string
127
     */
128
    public function getOrderId(): string
129
    {
130
        return $this->orderId;
131
    }
132
133
    /**
134
     * @return int
135
     */
136
    public function getOrderStatus(): int
137
    {
138
        return $this->orderStatus;
139
    }
140
141
    /**
142
     * @return \DateTime
143
     */
144
    public function getOrderTime(): \DateTime
145
    {
146
        return $this->orderTime;
147
    }
148
149
    /**
150
     * @return int
151
     */
152
    public function getOrderType(): int
153
    {
154
        return $this->orderType;
155
    }
156
157
    /**
158
     * @return string
159
     */
160
    public function getSerialNo(): string
161
    {
162
        return $this->serialNo;
163
    }
164
165
    /**
166
     * @return float
167
     */
168
    public function getValue(): float
169
    {
170
        return $this->value;
171
    }
172
173
    /**
174
     * @return string
175
     */
176
    public function getValueCoin(): string
177
    {
178
        return $this->valueCoin;
179
    }
180
}
181