Total Complexity | 2 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class WebSocketException extends Exception |
||
8 | { |
||
9 | /** |
||
10 | * Get the payload, Pusher-like formatted. |
||
11 | * |
||
12 | * @return array |
||
13 | */ |
||
14 | public function getPayload() |
||
15 | { |
||
16 | return [ |
||
17 | 'event' => 'pusher:error', |
||
18 | 'data' => [ |
||
19 | 'message' => $this->getMessage(), |
||
20 | 'code' => $this->getCode(), |
||
21 | ], |
||
22 | ]; |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Trigger the exception message. |
||
27 | * |
||
28 | * @param string $message |
||
29 | * @param int $code |
||
30 | * @return void |
||
31 | */ |
||
32 | public function trigger(string $message, int $code = 4001) |
||
36 | } |
||
37 | } |
||
38 |