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

CancelOrderResponse   A

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

215
        $this->createTime = DateTimeHelper::makeFromTimestamp(/** @scrutinizer ignore-type */ $createTime);
Loading history...
216
        return $this;
217
    }
218
219
    /**
220
     * @return \DateTime
221
     */
222
    public function getCreateTime(): \DateTime
223
    {
224
        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...
225
    }
226
227
    /**
228
     * @param float $orderQty
229
     * @return CancelOrderResponse
230
     */
231
    private function setOrderQty(?float $orderQty): self
232
    {
233
        $this->orderQty = $orderQty;
234
        return $this;
235
    }
236
237
    /**
238
     * @return float
239
     */
240
    public function getOrderQty(): ?float
241
    {
242
        return $this->orderQty;
243
    }
244
245
    /**
246
     * @param float $execQty
247
     * @return CancelOrderResponse
248
     */
249
    private function setExecQty(?float $execQty): self
250
    {
251
        $this->execQty = $execQty;
252
        return $this;
253
    }
254
255
    /**
256
     * @return float
257
     */
258
    public function getExecQty(): ?float
259
    {
260
        return $this->execQty;
261
    }
262
263
    /**
264
     * @param string $timeInForce
265
     * @return CancelOrderResponse
266
     */
267
    private function setTimeInForce(?string $timeInForce): self
268
    {
269
        $this->timeInForce = $timeInForce;
270
        return $this;
271
    }
272
273
    /**
274
     * @return string
275
     */
276
    public function getTimeInForce(): ?string
277
    {
278
        return $this->timeInForce;
279
    }
280
281
    /**
282
     * @param string $orderType
283
     * @return CancelOrderResponse
284
     */
285
    private function setOrderType(?string $orderType): self
286
    {
287
        $this->orderType = $orderType;
288
        return $this;
289
    }
290
291
    /**
292
     * @return string
293
     */
294
    public function getOrderType(): ?string
295
    {
296
        return $this->orderType;
297
    }
298
299
    /**
300
     * @param string $side
301
     * @return CancelOrderResponse
302
     */
303
    public function setSide(?string $side): self
304
    {
305
        $this->side = $side;
306
        return $this;
307
    }
308
309
    /**
310
     * @return string
311
     */
312
    public function getSide(): ?string
313
    {
314
        return $this->side;
315
    }
316
}