GetOrderResponse::getOrderId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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

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

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