CancelOrderResponse   A
last analyzed

Complexity

Total Complexity 25

Size/Duplication

Total Lines 308
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 25
eloc 62
dl 0
loc 308
rs 10
c 0
b 0
f 0

25 Methods

Rating   Name   Duplication   Size   Complexity  
A getOrderQty() 0 3 1
A getOrderId() 0 3 1
A setOrderLinkId() 0 4 1
A setOrderQty() 0 4 1
A setAccountId() 0 4 1
A getOrderType() 0 3 1
A setExecQty() 0 4 1
A getAccountId() 0 3 1
A getSymbol() 0 3 1
A setOrderId() 0 4 1
A getTimeInForce() 0 3 1
A setCreateTime() 0 4 1
A setStatus() 0 4 1
A getOrderLinkId() 0 3 1
A setTimeInForce() 0 4 1
A getCreateTime() 0 3 1
A setOrderPrice() 0 4 1
A getStatus() 0 3 1
A setOrderType() 0 4 1
A setSide() 0 4 1
A setSymbol() 0 4 1
A getSide() 0 3 1
A __construct() 0 15 1
A getOrderPrice() 0 3 1
A getExecQty() 0 3 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Spot\Trade\CancelOrder\Response;
4
5
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
6
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
7
use Carpenstar\ByBitAPI\Spot\Trade\CancelOrder\Interfaces\ICancelOrderResponseInterface;
8
9
class CancelOrderResponse extends AbstractResponse implements ICancelOrderResponseInterface
10
{
11
    /**
12
     * Order ID
13
     * @var int $orderId
14
     */
15
    private ?int $orderId;
16
17
    /**
18
     * User-generated order ID
19
     * @var string $orderLinkId
20
     */
21
    private ?string $orderLinkId;
22
23
    /**
24
     * Name of the trading pair
25
     * @var string $symbol
26
     */
27
    private ?string $symbol;
28
29
    /**
30
     * Order status
31
     * @var string $status
32
     */
33
    private ?string $status;
34
35
    /**
36
     * Account ID
37
     * @var int $accountId
38
     */
39
    private ?int $accountId;
40
41
    /**
42
     * Order price
43
     * @var float $orderPrice
44
     */
45
    private ?float $orderPrice;
46
47
    /**
48
     * Order Creation Time
49
     * @var \DateTime $createTime
50
     */
51
    private ?\DateTime $createTime;
52
53
    /**
54
     * Order quantity
55
     * @var float $orderQty
56
     */
57
    private ?float $orderQty;
58
59
    /**
60
     * Executed quantity
61
     * @var float $execQty
62
     */
63
    private ?float $execQty;
64
65
    /**
66
     * Time in force
67
     * @var string $timeInForce
68
     */
69
    private ?string $timeInForce;
70
71
    /**
72
     * Order type
73
     * @var string $orderType
74
     */
75
    private ?string $orderType;
76
77
    /**
78
     * Side. BUY, SELL
79
     * @var string $side
80
     */
81
    private ?string $side;
82
83
    /**
84
     * @param array $data
85
     */
86
    public function __construct(array $data)
87
    {
88
        $this
89
            ->setOrderId($data['orderId'])
90
            ->setOrderLinkId($data['orderLinkId'])
91
            ->setSymbol($data['symbol'])
92
            ->setStatus($data['status'])
93
            ->setAccountId($data['accountId'])
94
            ->setOrderPrice($data['orderPrice'])
95
            ->setCreateTime($data['createTime'])
96
            ->setOrderQty($data['orderQty'])
97
            ->setExecQty($data['execQty'])
98
            ->setTimeInForce($data['timeInForce'])
99
            ->setOrderType($data['orderType'])
100
            ->setSide($data['side']);
101
    }
102
103
    /**
104
     * @param int $orderId
105
     * @return CancelOrderResponse
106
     */
107
    private function setOrderId(?int $orderId): self
108
    {
109
        $this->orderId = $orderId;
110
        return $this;
111
    }
112
113
    /**
114
     * @return int
115
     */
116
    public function getOrderId(): ?int
117
    {
118
        return $this->orderId;
119
    }
120
121
    /**
122
     * @param string $orderLinkId
123
     * @return CancelOrderResponse
124
     */
125
    private function setOrderLinkId(?string $orderLinkId): self
126
    {
127
        $this->orderLinkId = $orderLinkId;
128
        return $this;
129
    }
130
131
    /**
132
     * @return string
133
     */
134
    public function getOrderLinkId(): string
135
    {
136
        return $this->orderLinkId;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->orderLinkId could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
137
    }
138
139
    /**
140
     * @param string $symbol
141
     * @return CancelOrderResponse
142
     */
143
    private function setSymbol(?string $symbol): self
144
    {
145
        $this->symbol = $symbol;
146
        return $this;
147
    }
148
149
    /**
150
     * @return string
151
     */
152
    public function getSymbol(): string
153
    {
154
        return $this->symbol;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->symbol could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
155
    }
156
157
    /**
158
     * @param string $status
159
     * @return CancelOrderResponse
160
     */
161
    private function setStatus(?string $status): self
162
    {
163
        $this->status = $status;
164
        return $this;
165
    }
166
167
    /**
168
     * @return string
169
     */
170
    public function getStatus(): string
171
    {
172
        return $this->status;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->status could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
173
    }
174
175
    /**
176
     * @param int $accountId
177
     * @return CancelOrderResponse
178
     */
179
    private function setAccountId(?int $accountId): self
180
    {
181
        $this->accountId = $accountId;
182
        return $this;
183
    }
184
185
    /**
186
     * @return int
187
     */
188
    public function getAccountId(): ?int
189
    {
190
        return $this->accountId;
191
    }
192
193
    /**
194
     * @param float $orderPrice
195
     * @return CancelOrderResponse
196
     */
197
    private function setOrderPrice(?float $orderPrice): self
198
    {
199
        $this->orderPrice = $orderPrice;
200
        return $this;
201
    }
202
203
    /**
204
     * @return float
205
     */
206
    public function getOrderPrice(): ?float
207
    {
208
        return $this->orderPrice;
209
    }
210
211
    /**
212
     * @param string|null $createTime
213
     * @return CancelOrderResponse
214
     */
215
    private function setCreateTime(?string $createTime): self
216
    {
217
        $this->createTime = DateTimeHelper::makeFromTimestamp($createTime);
0 ignored issues
show
Bug introduced by
$createTime of type null|string is incompatible with the type integer expected by parameter $timestamp of Carpenstar\ByBitAPI\Core...er::makeFromTimestamp(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

217
        $this->createTime = DateTimeHelper::makeFromTimestamp(/** @scrutinizer ignore-type */ $createTime);
Loading history...
218
        return $this;
219
    }
220
221
    /**
222
     * @return \DateTime
223
     */
224
    public function getCreateTime(): \DateTime
225
    {
226
        return $this->createTime;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->createTime could return the type null which is incompatible with the type-hinted return DateTime. Consider adding an additional type-check to rule them out.
Loading history...
227
    }
228
229
    /**
230
     * @param float $orderQty
231
     * @return CancelOrderResponse
232
     */
233
    private function setOrderQty(?float $orderQty): self
234
    {
235
        $this->orderQty = $orderQty;
236
        return $this;
237
    }
238
239
    /**
240
     * @return float
241
     */
242
    public function getOrderQty(): ?float
243
    {
244
        return $this->orderQty;
245
    }
246
247
    /**
248
     * @param float $execQty
249
     * @return CancelOrderResponse
250
     */
251
    private function setExecQty(?float $execQty): self
252
    {
253
        $this->execQty = $execQty;
254
        return $this;
255
    }
256
257
    /**
258
     * @return float
259
     */
260
    public function getExecQty(): ?float
261
    {
262
        return $this->execQty;
263
    }
264
265
    /**
266
     * @param string $timeInForce
267
     * @return CancelOrderResponse
268
     */
269
    private function setTimeInForce(?string $timeInForce): self
270
    {
271
        $this->timeInForce = $timeInForce;
272
        return $this;
273
    }
274
275
    /**
276
     * @return string
277
     */
278
    public function getTimeInForce(): ?string
279
    {
280
        return $this->timeInForce;
281
    }
282
283
    /**
284
     * @param string $orderType
285
     * @return CancelOrderResponse
286
     */
287
    private function setOrderType(?string $orderType): self
288
    {
289
        $this->orderType = $orderType;
290
        return $this;
291
    }
292
293
    /**
294
     * @return string
295
     */
296
    public function getOrderType(): ?string
297
    {
298
        return $this->orderType;
299
    }
300
301
    /**
302
     * @param string $side
303
     * @return CancelOrderResponse
304
     */
305
    public function setSide(?string $side): self
306
    {
307
        $this->side = $side;
308
        return $this;
309
    }
310
311
    /**
312
     * @return string
313
     */
314
    public function getSide(): ?string
315
    {
316
        return $this->side;
317
    }
318
}
319