Test Failed
Pull Request — master (#13)
by Vladislav
09:26 queued 01:13
created

InstrumentInfoResponseItem::setAlias()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
namespace Carpenstar\ByBitAPI\Spot\MarketData\InstrumentInfo\Response;
3
4
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
5
use Carpenstar\ByBitAPI\Spot\MarketData\InstrumentInfo\Interfaces\IInstrumentInfoResponseItemInterface;
6
7
class InstrumentInfoResponseItem extends AbstractResponse implements IInstrumentInfoResponseItemInterface
8
{
9
    /**
10
     * Name of the trading pair
11
     * @var string $name
12
     */
13
    private string $name;
14
15
    /**
16
     * Alias
17
     * @var string $alias
18
     */
19
    private string $alias;
20
21
    /**
22
     * Base currency
23
     * @var string $baseCoin
24
     */
25
    private string $baseCoin;
26
27
    /**
28
     * Quote currency
29
     * @var string $quoteCoin
30
     */
31
    private string $quoteCoin;
32
33
    /**
34
     * Decimal precision (base currency)
35
     * @var float $basePrecision
36
     */
37
    private float $basePrecision;
38
39
    /**
40
     * Decimal precision (quote currency)
41
     * @var float $quotePrecision
42
     */
43
    private float $quotePrecision;
44
45
    /**
46
     * Min. order qty (Not valid for market buy orders)
47
     * @var float $minTradeQty
48
     */
49
    private float $minTradeQty;
50
51
    /**
52
     * Min. order value (Only valid for market buy orders)
53
     * @var float $minTradeAmt
54
     */
55
    private float $minTradeAmt;
56
57
    /**
58
     * Min. number of decimal places
59
     * @var float $minPricePrecision
60
     */
61
    private float $minPricePrecision;
62
63
    /**
64
     * Max. order qty (It is ignored when you place an order with order type LIMIT_MAK
65
     * @var float $maxTradeQty
66
     */
67
    private float $maxTradeQty;
68
69
    /**
70
     * Max. order value (It is ignored when you place an order with order type LIMIT_MAKER)
71
     * @var float $maxTradeAmt
72
     */
73
    private float $maxTradeAmt;
74
75
    /**
76
     * Category
77
     * @var int $category
78
     */
79
    private int $category;
80
81
    /**
82
     * Indicates that the price of this currency is relatively volatile
83
     * @var int $innovation
84
     */
85
    private int $innovation;
86
87
    /**
88
     * Indicates that the symbol open for trading
89
     * @var int $showStatus
90
     */
91
    private int $showStatus;
92
93
    /**
94
     * @param array $data
95
     */
96
    public function __construct(array $data)
97
    {
98
        $this
99
            ->setName($data['name'])
100
            ->setAlias($data['alias'])
101
            ->setBaseCoin($data['baseCoin'])
102
            ->setQuoteCoin($data['quoteCoin'])
103
            ->setBasePrecision($data['basePrecision'])
104
            ->setQuotePrecision($data['quotePrecision'])
105
            ->setMinTradeQty($data['minTradeQty'])
106
            ->setMinTradeAmt($data['minTradeAmt'])
107
            ->setMaxTradeQty($data['maxTradeQty'])
108
            ->setMaxTradeAmt($data['maxTradeAmt'])
109
            ->setMinPricePrecision($data['minPricePrecision'])
110
            ->setCategory($data['category'])
111
            ->setShowStatus($data['showStatus'])
112
            ->setInnovation($data['innovation']);
113
    }
114
115
    /**
116
     * @param string $name
117
     * @return $this
118
     */
119
    private function setName(string $name): self
120
    {
121
        $this->name = $name;
122
        return $this;
123
    }
124
125
    /**
126
     * @return string
127
     */
128
    public function getName(): string
129
    {
130
        return $this->name;
131
    }
132
133
    /**
134
     * @param string $alias
135
     * @return $this
136
     */
137
    private function setAlias(string $alias): self
138
    {
139
        $this->alias = $alias;
140
        return $this;
141
    }
142
143
    /**
144
     * @return string
145
     */
146
    public function getAlias(): string
147
    {
148
        return $this->alias;
149
    }
150
151
    /**
152
     * @param string $baseCoin
153
     * @return $this
154
     */
155
    private function setBaseCoin(string $baseCoin): self
156
    {
157
        $this->baseCoin = $baseCoin;
158
        return $this;
159
    }
160
161
    /**
162
     * @return string
163
     */
164
    public function getBaseCoin(): string
165
    {
166
        return $this->baseCoin;
167
    }
168
169
    /**
170
     * @param string $quoteCoin
171
     * @return $this
172
     */
173
    private function setQuoteCoin(string $quoteCoin): self
174
    {
175
        $this->quoteCoin = $quoteCoin;
176
        return $this;
177
    }
178
179
    /**
180
     * @return string
181
     */
182
    public function getQuoteCoin(): string
183
    {
184
        return $this->quoteCoin;
185
    }
186
187
    /**
188
     * @param float $basePrecision
189
     * @return $this
190
     */
191
    private function setBasePrecision(float $basePrecision): self
192
    {
193
        $this->basePrecision = $basePrecision;
194
        return $this;
195
    }
196
197
    /**
198
     * @return float
199
     */
200
    public function getBasePrecision(): float
201
    {
202
        return $this->basePrecision;
203
    }
204
205
    /**
206
     * @param float $quotePrecision
207
     * @return $this
208
     */
209
    private function setQuotePrecision(float $quotePrecision): self
210
    {
211
        $this->quotePrecision = $quotePrecision;
212
        return $this;
213
    }
214
215
    /**
216
     * @return float
217
     */
218
    public function getQuotePrecision(): float
219
    {
220
        return $this->quotePrecision;
221
    }
222
223
    /**
224
     * @param float $minTradeQty
225
     * @return $this
226
     */
227
    private function setMinTradeQty(float $minTradeQty): self
228
    {
229
        $this->minTradeQty = $minTradeQty;
230
        return $this;
231
    }
232
233
    /**
234
     * @return float
235
     */
236
    public function getMinTradeQty(): float
237
    {
238
        return $this->minTradeQty;
239
    }
240
241
    /**
242
     * @param float $minTradeAmt
243
     * @return $this
244
     */
245
    private function setMinTradeAmt(float $minTradeAmt): self
246
    {
247
        $this->minTradeAmt = $minTradeAmt;
248
        return $this;
249
    }
250
251
    /**
252
     * @return float
253
     */
254
    public function getMinTradeAmt(): float
255
    {
256
        return $this->minTradeAmt;
257
    }
258
259
    /**
260
     * @param float $maxTradeQty
261
     * @return $this
262
     */
263
    private function setMaxTradeQty(float $maxTradeQty): self
264
    {
265
        $this->maxTradeQty = $maxTradeQty;
266
        return $this;
267
    }
268
269
    /**
270
     * @return float
271
     */
272
    public function getMaxTradeQty(): float
273
    {
274
        return $this->maxTradeQty;
275
    }
276
277
    /**
278
     * @param float $maxTradeAmt
279
     * @return $this
280
     */
281
    private function setMaxTradeAmt(float $maxTradeAmt): self
282
    {
283
        $this->maxTradeAmt = $maxTradeAmt;
284
        return $this;
285
    }
286
287
    /**
288
     * @return int
289
     */
290
    public function getMaxTradeAmt(): int
291
    {
292
        return $this->maxTradeAmt;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->maxTradeAmt returns the type double which is incompatible with the type-hinted return integer.
Loading history...
293
    }
294
295
    /**
296
     * @param float $minPricePrecision
297
     * @return $this
298
     */
299
    private function setMinPricePrecision(float $minPricePrecision): self
300
    {
301
        $this->minPricePrecision = $minPricePrecision;
302
        return $this;
303
    }
304
305
    /**
306
     * @return float
307
     */
308
    public function getMinPricePrecision(): float
309
    {
310
        return $this->minPricePrecision;
311
    }
312
313
    /**
314
     * @param int $category
315
     * @return $this
316
     */
317
    private function setCategory(int $category): self
318
    {
319
        $this->category = $category;
320
        return $this;
321
    }
322
323
    /**
324
     * @return int
325
     */
326
    public function getCategory(): int
327
    {
328
        return $this->category;
329
    }
330
331
    /**
332
     * @param int $showStatus
333
     * @return $this
334
     */
335
    private function setShowStatus(int $showStatus): self
336
    {
337
        $this->showStatus = $showStatus;
338
        return $this;
339
    }
340
341
    /**
342
     * @return int
343
     */
344
    public function getShowStatus(): int
345
    {
346
        return $this->showStatus;
347
    }
348
349
    /**
350
     * @param int $innovation
351
     * @return $this
352
     */
353
    private function setInnovation(int $innovation): self
354
    {
355
        $this->innovation = $innovation;
356
        return $this;
357
    }
358
359
    /**
360
     * @return int
361
     */
362
    public function getInnovation(): int
363
    {
364
        return $this->innovation;
365
    }
366
}