Test Failed
Push — master ( f1d563...1fab6c )
by Vladislav
10:20 queued 07:53
created

RiskLimitsResponseItem   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 109
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 22
c 1
b 0
f 0
dl 0
loc 109
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getMaintainMargin() 0 3 1
A getLimit() 0 3 1
A getIsLowerRisk() 0 3 1
A getId() 0 3 1
A getMaxLeverage() 0 3 1
A __construct() 0 9 1
A getInitialMargin() 0 3 1
A getSymbol() 0 3 1
1
<?php
2
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\RiskLimit\Response;
3
4
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
5
use Carpenstar\ByBitAPI\Derivatives\MarketData\RiskLimit\Interfaces\IRiskLimitsResponseItemInterface;
6
7
class RiskLimitsResponseItem extends AbstractResponse implements IRiskLimitsResponseItemInterface
8
{
9
    /**
10
     * Risk id
11
     * @var string $id
12
     */
13
    private string $id;
14
15
    /**
16
     * Symbol name
17
     * @var string $symbol
18
     */
19
    private string $symbol;
20
21
    /**
22
     * Position limit
23
     * @var int $limit
24
     */
25
    private int $limit;
26
27
    /**
28
     * Maintain margin rate
29
     * @var float $maintainMargin
30
     */
31
    private float $maintainMargin;
32
33
    /**
34
     * Initial margin rate
35
     * @var float $initialMargin
36
     */
37
    private float $initialMargin;
38
39
    /**
40
     * 1: true, 0: false
41
     * @var int $isLowerRisk
42
     */
43
    private ?int $isLowerRisk;
44
45
    /**
46
     * Allowed max leverage
47
     * @var float $maxLeverage
48
     */
49
    private float $maxLeverage;
50
51
    public function __construct(array $data)
52
    {
53
        $this->id = $data['id'];
54
        $this->symbol = $data['symbol'];
55
        $this->limit = $data['limit'];
56
        $this->initialMargin = $data['initialMargin'];
57
        $this->maintainMargin = $data['maintainMargin'];
58
        $this->maxLeverage = $data['maxLeverage'];
59
        $this->isLowerRisk = (int) $data['isLowerRisk'];
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getId(): string
66
    {
67
        return $this->id;
68
    }
69
70
    /**
71
     * @return string
72
     */
73
    public function getSymbol(): string
74
    {
75
        return $this->symbol;
76
    }
77
78
    /**
79
     * @return int
80
     */
81
    public function getLimit(): int
82
    {
83
        return $this->limit;
84
    }
85
86
    /**
87
     * @return float
88
     */
89
    public function getMaintainMargin(): float
90
    {
91
        return $this->maintainMargin;
92
    }
93
94
    /**
95
     * @return float
96
     */
97
    public function getInitialMargin(): float
98
    {
99
        return $this->initialMargin;
100
    }
101
102
    /**
103
     * @return int
104
     */
105
    public function getIsLowerRisk(): int
106
    {
107
        return $this->isLowerRisk;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->isLowerRisk could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
108
    }
109
110
    /**
111
     * @return float
112
     */
113
    public function getMaxLeverage(): float
114
    {
115
        return $this->maxLeverage;
116
    }
117
}