1 | <?php |
||
20 | abstract class AbstractCommand implements SerializableCommandInterface |
||
21 | { |
||
22 | private string $method; |
||
|
|||
23 | private array $params; |
||
24 | |||
25 | /** |
||
26 | * @param string $method |
||
27 | * @param array $params |
||
28 | */ |
||
29 | public function __construct(string $method, array $params) |
||
30 | { |
||
31 | $this->method = $method; |
||
32 | $this->params = $params; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return string |
||
37 | */ |
||
38 | public function getMethod(): string |
||
39 | { |
||
40 | return $this->method; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return array |
||
45 | */ |
||
46 | public function getParams(): array |
||
47 | { |
||
48 | return $this->params; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | public function getChannels(): iterable |
||
55 | { |
||
56 | return []; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @return array |
||
61 | */ |
||
62 | public function jsonSerialize(): array |
||
63 | { |
||
64 | return [ |
||
65 | 'method' => $this->method, |
||
66 | 'params' => $this->params, |
||
67 | ]; |
||
68 | } |
||
69 | } |
||
70 |