Passed
Push — master ( 7a134a...be08d2 )
by Vladislav
02:35 queued 13s
created

GetOrderResponse   A

Complexity

Total Complexity 37

Size/Duplication

Total Lines 458
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 37
eloc 92
dl 0
loc 458
rs 9.44
c 0
b 0
f 0

37 Methods

Rating   Name   Duplication   Size   Complexity  
A setTimeInForce() 0 4 1
A getIsWorking() 0 3 1
A __construct() 0 21 1
A getTimeInForce() 0 3 1
A setExecQty() 0 4 1
A getCummulativeQuoteQty() 0 3 1
A setLocked() 0 4 1
A getOrderLinkId() 0 3 1
A setSide() 0 4 1
A getAvgPrice() 0 3 1
A getOrderPrice() 0 3 1
A getCreateTime() 0 3 1
A getOrderQty() 0 3 1
A getLocked() 0 3 1
A getAccountId() 0 3 1
A getSide() 0 3 1
A getUpdateTime() 0 3 1
A setSymbol() 0 4 1
A setOrderQty() 0 4 1
A setOrderLinkId() 0 4 1
A setOrderPrice() 0 4 1
A setAvgPrice() 0 4 1
A setStatus() 0 4 1
A setAccountId() 0 4 1
A setUpdateTime() 0 4 1
A setCummulativeQuoteQty() 0 4 1
A setOrderType() 0 4 1
A setCreateTime() 0 4 1
A getStatus() 0 3 1
A getSymbol() 0 3 1
A getStopPrice() 0 3 1
A getExecQty() 0 3 1
A getOrderId() 0 3 1
A setOrderId() 0 4 1
A setStopPrice() 0 4 1
A getOrderType() 0 3 1
A setIsWorking() 0 4 1
1
<?php
2
namespace Carpenstar\ByBitAPI\Spot\Trade\GetOrder\Response;
3
4
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
5
use Carpenstar\ByBitAPI\Core\Objects\ResponseEntity;
6
7
class GetOrderResponse extends ResponseEntity
8
{
9
    /**
10
     * Account ID
11
     * @var int $accountId
12
     */
13
    private int $accountId;
14
15
    /**
16
     * Name of the trading pair
17
     * @var string $symbol
18
     */
19
    private string $symbol;
20
21
    /**
22
     * User-generated order ID
23
     * @var string $orderLinkId
24
     */
25
    private string $orderLinkId;
26
27
    /**
28
     * Order ID
29
     * @var int $orderId
30
     */
31
    private int $orderId;
32
33
    /**
34
     * Order price
35
     * @var float $orderPrice
36
     */
37
    private float $orderPrice;
38
39
    /**
40
     * Order quantity
41
     * @var float $orderQty
42
     */
43
    private float $orderQty;
44
45
    /**
46
     * Executed quantity
47
     * @var float $execQty
48
     */
49
    private float $execQty;
50
51
    /**
52
     * Total order quantity. For some historical data, it might less than 0, and that means it is not applicable
53
     * @var float $cummulativeQuoteQty
54
     */
55
    private float $cummulativeQuoteQty;
56
57
    /**
58
     * Average filled price
59
     * @var float $avgPrice
60
     */
61
    private float $avgPrice;
62
63
    /**
64
     * Order status
65
     * @var string $status
66
     */
67
    private string $status;
68
69
    /**
70
     * Time in force. E.q. EnumTimeInForce::GOOD_TILL_CANCELED
71
     * @var string $timeInForce
72
     */
73
    private string $timeInForce;
74
75
    /**
76
     * Order type
77
     * @var string $orderType
78
     */
79
    private string $orderType;
80
81
    /**
82
     * Order direction
83
     * @var string $side
84
     */
85
    private string $side;
86
87
    /**
88
     * Stop price
89
     * @var float $stopPrice
90
     */
91
    private float $stopPrice;
92
93
    /**
94
     * Order created time in the match engine
95
     * @var \DateTime $createTime
96
     */
97
    private \DateTime $createTime;
98
99
    /**
100
     * Last time order was updated
101
     * @var \DateTime $updateTime
102
     */
103
    private \DateTime $updateTime;
104
105
    /**
106
     * Is working. 0:valid, 1:invalid
107
     * @var int $isWorking
108
     */
109
    private int $isWorking;
110
111
    /**
112
     * Reserved for order (if it's 0, it means that the funds corresponding to the order have been settled)
113
     * @var float $locked
114
     */
115
    private float $locked;
116
117
    /**
118
     * @param array $data
119
     */
120
    public function __construct(array $data)
121
    {
122
        $this
123
            ->setAccountId($data['accountId'])
124
            ->setSymbol($data['symbol'])
125
            ->setOrderLinkId($data['orderLinkId'])
126
            ->setOrderId($data['orderId'])
127
            ->setOrderPrice($data['orderPrice'])
128
            ->setOrderQty($data['orderQty'])
129
            ->setExecQty($data['execQty'])
130
            ->setCummulativeQuoteQty($data['cummulativeQuoteQty'])
131
            ->setAvgPrice($data['avgPrice'])
132
            ->setStatus($data['status'])
133
            ->setTimeInForce($data['timeInForce'])
134
            ->setOrderType($data['orderType'])
135
            ->setSide($data['side'])
136
            ->setStopPrice($data['stopPrice'])
137
            ->setCreateTime($data['createTime'])
138
            ->setUpdateTime($data['updateTime'])
139
            ->setIsWorking($data['isWorking'])
140
            ->setLocked($data['locked']);
141
    }
142
143
    /**
144
     * @return string
145
     */
146
    public function getOrderLinkId(): string
147
    {
148
        return $this->orderLinkId;
149
    }
150
151
    /**
152
     * @param string $orderLinkId
153
     * @return GetOrderResponse
154
     */
155
    private function setOrderLinkId(string $orderLinkId): self
156
    {
157
        $this->orderLinkId = $orderLinkId;
158
        return $this;
159
    }
160
161
    /**
162
     * @return int
163
     */
164
    public function getOrderId(): int
165
    {
166
        return $this->orderId;
167
    }
168
169
    /**
170
     * @param int $orderId
171
     * @return GetOrderResponse
172
     */
173
    private function setOrderId(int $orderId): self
174
    {
175
        $this->orderId = $orderId;
176
        return $this;
177
    }
178
179
    /**
180
     * @return float
181
     */
182
    public function getOrderPrice(): float
183
    {
184
        return $this->orderPrice;
185
    }
186
187
    /**
188
     * @param float $orderPrice
189
     * @return GetOrderResponse
190
     */
191
    private function setOrderPrice(float $orderPrice): self
192
    {
193
        $this->orderPrice = $orderPrice;
194
        return $this;
195
    }
196
197
    /**
198
     * @return string
199
     */
200
    public function getSymbol(): string
201
    {
202
        return $this->symbol;
203
    }
204
205
    /**
206
     * @param string $symbol
207
     * @return GetOrderResponse
208
     */
209
    private function setSymbol(string $symbol): self
210
    {
211
        $this->symbol = $symbol;
212
        return $this;
213
    }
214
215
    /**
216
     * @return int
217
     */
218
    public function getAccountId(): int
219
    {
220
        return $this->accountId;
221
    }
222
223
    /**
224
     * @param int $accountId
225
     * @return GetOrderResponse
226
     */
227
    private function setAccountId(int $accountId): self
228
    {
229
        $this->accountId = $accountId;
230
        return $this;
231
    }
232
233
    /**
234
     * @return float
235
     */
236
    public function getAvgPrice(): float
237
    {
238
        return $this->avgPrice;
239
    }
240
241
    /**
242
     * @param float $avgPrice
243
     * @return GetOrderResponse
244
     */
245
    private function setAvgPrice(float $avgPrice): self
246
    {
247
        $this->avgPrice = $avgPrice;
248
        return $this;
249
    }
250
251
    /**
252
     * @return \DateTime
253
     */
254
    public function getCreateTime(): \DateTime
255
    {
256
        return $this->createTime;
257
    }
258
259
    /**
260
     * @param string $createTime
261
     * @return GetOrderResponse
262
     */
263
    private function setCreateTime(string $createTime): self
264
    {
265
        $this->createTime = DateTimeHelper::makeFromTimestamp($createTime);
0 ignored issues
show
Bug introduced by
$createTime of type 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

265
        $this->createTime = DateTimeHelper::makeFromTimestamp(/** @scrutinizer ignore-type */ $createTime);
Loading history...
266
        return $this;
267
    }
268
269
    /**
270
     * @return float
271
     */
272
    public function getCummulativeQuoteQty(): float
273
    {
274
        return $this->cummulativeQuoteQty;
275
    }
276
277
    /**
278
     * @param float $cummulativeQuoteQty
279
     * @return GetOrderResponse
280
     */
281
    private function setCummulativeQuoteQty(float $cummulativeQuoteQty): self
282
    {
283
        $this->cummulativeQuoteQty = $cummulativeQuoteQty;
284
        return $this;
285
    }
286
287
    /**
288
     * @return float
289
     */
290
    public function getExecQty(): float
291
    {
292
        return $this->execQty;
293
    }
294
295
    /**
296
     * @param float $execQty
297
     * @return GetOrderResponse
298
     */
299
    private function setExecQty(float $execQty): self
300
    {
301
        $this->execQty = $execQty;
302
        return $this;
303
    }
304
305
    /**
306
     * @return int
307
     */
308
    public function getIsWorking(): int
309
    {
310
        return $this->isWorking;
311
    }
312
313
    /**
314
     * @param int $isWorking
315
     * @return GetOrderResponse
316
     */
317
    private function setIsWorking(int $isWorking): self
318
    {
319
        $this->isWorking = $isWorking;
320
        return $this;
321
    }
322
323
    /**
324
     * @return float
325
     */
326
    public function getLocked(): float
327
    {
328
        return $this->locked;
329
    }
330
331
    /**
332
     * @param float $locked
333
     * @return GetOrderResponse
334
     */
335
    private function setLocked(float $locked): self
336
    {
337
        $this->locked = $locked;
338
        return $this;
339
    }
340
341
    /**
342
     * @return float
343
     */
344
    public function getOrderQty(): float
345
    {
346
        return $this->orderQty;
347
    }
348
349
    /**
350
     * @param float $orderQty
351
     * @return GetOrderResponse
352
     */
353
    private function setOrderQty(float $orderQty): self
354
    {
355
        $this->orderQty = $orderQty;
356
        return $this;
357
    }
358
359
    /**
360
     * @return string
361
     */
362
    public function getOrderType(): string
363
    {
364
        return $this->orderType;
365
    }
366
367
    /**
368
     * @param string $orderType
369
     * @return GetOrderResponse
370
     */
371
    private function setOrderType(string $orderType): self
372
    {
373
        $this->orderType = $orderType;
374
        return $this;
375
    }
376
377
    /**
378
     * @return string
379
     */
380
    public function getSide(): string
381
    {
382
        return $this->side;
383
    }
384
385
    /**
386
     * @param string $side
387
     * @return GetOrderResponse
388
     */
389
    private function setSide(string $side): self
390
    {
391
        $this->side = $side;
392
        return $this;
393
    }
394
395
    /**
396
     * @return string
397
     */
398
    public function getStatus(): string
399
    {
400
        return $this->status;
401
    }
402
403
    /**
404
     * @param string $status
405
     * @return GetOrderResponse
406
     */
407
    private function setStatus(string $status): self
408
    {
409
        $this->status = $status;
410
        return $this;
411
    }
412
413
    /**
414
     * @return float
415
     */
416
    public function getStopPrice(): float
417
    {
418
        return $this->stopPrice;
419
    }
420
421
    /**
422
     * @param float $stopPrice
423
     * @return GetOrderResponse
424
     */
425
    private function setStopPrice(float $stopPrice): self
426
    {
427
        $this->stopPrice = $stopPrice;
428
        return $this;
429
    }
430
431
    /**
432
     * @return string
433
     */
434
    public function getTimeInForce(): string
435
    {
436
        return $this->timeInForce;
437
    }
438
439
    /**
440
     * @param string $timeInForce
441
     * @return GetOrderResponse
442
     */
443
    private function setTimeInForce(string $timeInForce): self
444
    {
445
        $this->timeInForce = $timeInForce;
446
        return $this;
447
    }
448
449
    /**
450
     * @return \DateTime
451
     */
452
    public function getUpdateTime(): \DateTime
453
    {
454
        return $this->updateTime;
455
    }
456
457
    /**
458
     * @param string $updateTime
459
     * @return GetOrderResponse
460
     */
461
    private function setUpdateTime(string $updateTime): self
462
    {
463
        $this->updateTime = DateTimeHelper::makeFromTimestamp($updateTime);
0 ignored issues
show
Bug introduced by
$updateTime of type 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

463
        $this->updateTime = DateTimeHelper::makeFromTimestamp(/** @scrutinizer ignore-type */ $updateTime);
Loading history...
464
        return $this;
465
    }
466
}