Total Complexity | 11 |
Total Lines | 135 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
6 | class WalletBalanceResponse extends ResponseEntity |
||
7 | { |
||
8 | public static string $rootDataKey = 'balances'; |
||
9 | |||
10 | /** |
||
11 | * Coin |
||
12 | * @var string $coin |
||
13 | */ |
||
14 | private string $coin; |
||
15 | |||
16 | /** |
||
17 | * Coin ID |
||
18 | * @var string $coinId |
||
19 | */ |
||
20 | private string $coinId; |
||
21 | |||
22 | /** |
||
23 | * Total equity |
||
24 | * @var float |
||
25 | */ |
||
26 | private float $total; |
||
27 | |||
28 | /** |
||
29 | * Available balance |
||
30 | * @var float |
||
31 | */ |
||
32 | private float $free; |
||
33 | |||
34 | /** |
||
35 | * Reserved for orders |
||
36 | * @var bool |
||
37 | */ |
||
38 | private bool $locked; |
||
39 | |||
40 | /** |
||
41 | * @param array $data |
||
42 | */ |
||
43 | public function __construct(array $data) |
||
44 | { |
||
45 | $this |
||
46 | ->setCoin($data['coin']) |
||
47 | ->setCoinId($data['coinId']) |
||
48 | ->setFree($data['free']) |
||
49 | ->setTotal($data['total']) |
||
50 | ->setLocked($data['locked']); |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param string $coin |
||
55 | * @return $this |
||
56 | */ |
||
57 | private function setCoin(string $coin): self |
||
58 | { |
||
59 | $this->coin = $coin; |
||
60 | return $this; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getCoin(): string |
||
67 | { |
||
68 | return $this->coin; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @param string $coinId |
||
73 | * @return $this |
||
74 | */ |
||
75 | private function setCoinId(string $coinId): self |
||
76 | { |
||
77 | $this->coinId = $coinId; |
||
78 | return $this; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * @return string |
||
83 | */ |
||
84 | public function getCoinId(): string |
||
85 | { |
||
86 | return $this->coinId; |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * @param float $total |
||
91 | * @return $this |
||
92 | */ |
||
93 | private function setTotal(float $total): self |
||
94 | { |
||
95 | $this->total = $total; |
||
96 | return $this; |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * @return float |
||
101 | */ |
||
102 | public function getTotal(): float |
||
103 | { |
||
104 | return $this->total; |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * @param float $free |
||
109 | * @return $this |
||
110 | */ |
||
111 | private function setFree(float $free): self |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * @return float |
||
119 | */ |
||
120 | public function getFree(): float |
||
121 | { |
||
122 | return $this->free; |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * @param int $locked |
||
127 | * @return $this |
||
128 | */ |
||
129 | private function setLocked(int $locked): self |
||
130 | { |
||
131 | $this->locked = (bool)$locked; |
||
132 | return $this; |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * @return bool |
||
137 | */ |
||
138 | public function getLocked(): bool |
||
141 | } |
||
142 | } |