1 | <?php |
||
15 | class BittrexClient |
||
16 | { |
||
17 | /** |
||
18 | * Main URL to Bittrex Exchange |
||
19 | */ |
||
20 | private const BASE_URI = 'https://api.bittrex.com'; |
||
21 | |||
22 | /** @var Client */ |
||
23 | private $publicClient; |
||
24 | |||
25 | /** @var Client */ |
||
26 | private $privateClient; |
||
27 | |||
28 | /** @var string */ |
||
29 | private $key = ''; |
||
30 | |||
31 | /** @var string */ |
||
32 | private $secret = ''; |
||
33 | |||
34 | /** @var string */ |
||
35 | private $currentMinuteCount = 0; |
||
36 | /** |
||
37 | * @var int |
||
38 | */ |
||
39 | private $lastAPITime; |
||
40 | /** |
||
41 | * @var int |
||
42 | */ |
||
43 | private $prevMinuteCount = 0; |
||
44 | |||
45 | /** |
||
46 | * BittrexClient constructor. |
||
47 | */ |
||
48 | 9 | public function __construct() |
|
52 | |||
53 | /** |
||
54 | * @return int |
||
55 | */ |
||
56 | 1 | public function getCurrentMinuteCount(): int |
|
60 | |||
61 | /** |
||
62 | * @param string $key |
||
63 | * @param string $secret |
||
64 | */ |
||
65 | 3 | public function setCredential(string $key, string $secret): void |
|
70 | |||
71 | /** |
||
72 | * @return PublicApi |
||
73 | */ |
||
74 | 3 | public function public(): PublicApi |
|
80 | |||
81 | /** |
||
82 | * Counting in minute API |
||
83 | */ |
||
84 | 7 | private function countAPI(): void |
|
95 | |||
96 | /** |
||
97 | * @return Client |
||
98 | */ |
||
99 | 3 | private function getPublicClient(): Client |
|
103 | |||
104 | /** |
||
105 | * @return Client |
||
106 | */ |
||
107 | 3 | private function createPublicClient(): Client |
|
118 | |||
119 | /** |
||
120 | * @return Market |
||
121 | * @throws InvalidCredentialException |
||
122 | */ |
||
123 | 2 | public function market(): Market |
|
128 | |||
129 | /** |
||
130 | * @return Client |
||
131 | * @throws InvalidCredentialException |
||
132 | */ |
||
133 | 4 | private function getPrivateClient(): Client |
|
137 | |||
138 | /** |
||
139 | * @return Client |
||
140 | * @throws InvalidCredentialException |
||
141 | */ |
||
142 | 4 | private function createPrivateClient(): Client |
|
160 | |||
161 | /** |
||
162 | * @return string |
||
163 | */ |
||
164 | 4 | public function getKey(): string |
|
168 | |||
169 | /** |
||
170 | * @return string |
||
171 | */ |
||
172 | 4 | public function getSecret(): string |
|
176 | |||
177 | /** |
||
178 | * @return Account |
||
179 | * @throws InvalidCredentialException |
||
180 | */ |
||
181 | 2 | public function account(): Account |
|
186 | |||
187 | /** |
||
188 | * @return int |
||
189 | */ |
||
190 | 1 | public function getPrevMinuteCount(): int |
|
194 | } |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.