@@ -22,7 +22,7 @@ |
||
| 22 | 22 | /** |
| 23 | 23 | * @param $request |
| 24 | 24 | * @param ConnectionInterface $from |
| 25 | - * @param $error |
|
| 25 | + * @param string $error |
|
| 26 | 26 | * @throws WebSocketException |
| 27 | 27 | */ |
| 28 | 28 | function error($request,ConnectionInterface $from, $error) |
@@ -49,16 +49,18 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | function sendToWebSocketUser(ConnectionInterface $conn,$data) |
| 51 | 51 | { |
| 52 | - if(!is_array($data)) |
|
| 53 | - $data = ['msg'=>$data,'event'=>'default']; |
|
| 52 | + if(!is_array($data)) { |
|
| 53 | + $data = ['msg'=>$data,'event'=>'default']; |
|
| 54 | + } |
|
| 54 | 55 | |
| 55 | 56 | if(!isset($data['event'])) |
| 56 | 57 | { |
| 57 | 58 | $data['event'] = 'default'; |
| 58 | 59 | } |
| 59 | 60 | |
| 60 | - if(isset($this->route) && !array_key_exists('sender',$data)) |
|
| 61 | - $data['sender'] = $this->getSenderData(); |
|
| 61 | + if(isset($this->route) && !array_key_exists('sender',$data)) { |
|
| 62 | + $data['sender'] = $this->getSenderData(); |
|
| 63 | + } |
|
| 62 | 64 | |
| 63 | 65 | $conn->send(json_encode($data)); |
| 64 | 66 | } |
@@ -44,8 +44,9 @@ |
||
| 44 | 44 | |
| 45 | 45 | function hasMember($client) |
| 46 | 46 | { |
| 47 | - if(array_key_exists($client->id,$this->members)) |
|
| 48 | - return true; |
|
| 47 | + if(array_key_exists($client->id,$this->members)) { |
|
| 48 | + return true; |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | return false; |
| 51 | 52 | } |
@@ -228,8 +228,7 @@ |
||
| 228 | 228 | |
| 229 | 229 | $this->clients[$from->resourceId]->id = \Auth::id(); |
| 230 | 230 | $this->userAuthSocketMapper[\Auth::id()] = $from->resourceId; |
| 231 | - } |
|
| 232 | - else |
|
| 231 | + } else |
|
| 233 | 232 | { |
| 234 | 233 | $this->error($msg, $from, 'Unauthenticated.'); |
| 235 | 234 | } |