Total Complexity | 6 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class OrderBookArgument extends WebSocketArgument |
||
9 | { |
||
10 | |||
11 | private int $depth; |
||
12 | |||
13 | /** |
||
14 | * @return array |
||
15 | * @throws \Exception |
||
16 | */ |
||
17 | public function getTopic(): array |
||
18 | { |
||
19 | if (!isset($this->depth)) { |
||
20 | throw new \Exception("You must set depth parameter!"); |
||
21 | } |
||
22 | |||
23 | $topics = []; |
||
24 | foreach ($this->symbols as $symbol) { |
||
25 | $topics[] = WebSocketTopicNameEnum::ORDERBOOK . ".{$this->getDepth()}." . $symbol; |
||
26 | } |
||
27 | |||
28 | return $topics; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param int $depth |
||
33 | * @return $this |
||
34 | */ |
||
35 | public function setDepth(int $depth): self |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return int |
||
43 | */ |
||
44 | public function getDepth(): int |
||
47 | } |
||
48 | |||
49 | |||
50 | /** |
||
51 | * @return string |
||
52 | */ |
||
53 | public function getOperation(): string |
||
56 | } |
||
57 | } |