@@ -51,10 +51,10 @@ |
||
| 51 | 51 | new Receiver() |
| 52 | 52 | ) |
| 53 | 53 | ), |
| 54 | - env('WEBSOCKET_PORT',9090) |
|
| 54 | + env('WEBSOCKET_PORT', 9090) |
|
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | - $this->info('Websocket is now running at port '.env('WEBSOCKET_PORT',9090)); |
|
| 57 | + $this->info('Websocket is now running at port '.env('WEBSOCKET_PORT', 9090)); |
|
| 58 | 58 | $server->run(); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $this->userAuthSocketMapper = []; |
| 48 | 48 | |
| 49 | 49 | $this->mainRoutes(); |
| 50 | - include base_path() . '/routes/websocket.php'; |
|
| 50 | + include base_path().'/routes/websocket.php'; |
|
| 51 | 51 | $this->routes = WsRoute::getRoutes(); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function onMessage(ConnectionInterface $from, $msg) |
| 69 | 69 | { |
| 70 | - $msg = json_decode($msg,true); |
|
| 71 | - $this->callRoute($from,$msg); |
|
| 70 | + $msg = json_decode($msg, true); |
|
| 71 | + $this->callRoute($from, $msg); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | function callRoute(ConnectionInterface $from, $msg) |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $this->resetSession($msg['session']); |
| 80 | 80 | |
| 81 | - $this->resetAuth($msg,$from); |
|
| 81 | + $this->resetAuth($msg, $from); |
|
| 82 | 82 | |
| 83 | 83 | $route = $this->routes[$msg['route']]; |
| 84 | 84 | |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | $routesToCall = $client->onCloseRoutes; |
| 122 | 122 | foreach ($routesToCall as $route) |
| 123 | 123 | { |
| 124 | - $msg = ['session'=>$client->session,'route'=>$route]; |
|
| 125 | - $this->callRoute($conn,$msg); |
|
| 124 | + $msg = ['session'=>$client->session, 'route'=>$route]; |
|
| 125 | + $this->callRoute($conn, $msg); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | unset($this->clients[$conn->resourceId]); |
| 129 | - unset($this->userAuthSocketMapper[array_search($conn->resourceId,$this->userAuthSocketMapper)]); |
|
| 129 | + unset($this->userAuthSocketMapper[array_search($conn->resourceId, $this->userAuthSocketMapper)]); |
|
| 130 | 130 | |
| 131 | 131 | echo "Connection {$conn->resourceId} has disconnected\n"; |
| 132 | 132 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | if ($data = \Session::getHandler()->read($session_id)) { |
| 194 | 194 | $data = @unserialize($data); |
| 195 | 195 | |
| 196 | - if ($data !== false && ! is_null($data) && is_array($data)) { |
|
| 196 | + if ($data !== false && !is_null($data) && is_array($data)) { |
|
| 197 | 197 | return $data; |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | function getUserModel() |
| 210 | 210 | { |
| 211 | - return \Config::get('laravel-ratchet.userModelNamespace','App\Entities\Users\User'); |
|
| 211 | + return \Config::get('laravel-ratchet.userModelNamespace', 'App\Entities\Users\User'); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | function resetSession($session_id) |
@@ -225,15 +225,15 @@ discard block |
||
| 225 | 225 | * @param ConnectionInterface $from |
| 226 | 226 | * @throws WebSocketException |
| 227 | 227 | */ |
| 228 | - function resetAuth($msg,$from) |
|
| 228 | + function resetAuth($msg, $from) |
|
| 229 | 229 | { |
| 230 | 230 | $data = $this->readFromHandler($msg['session']); |
| 231 | 231 | |
| 232 | - if(!empty($data)) |
|
| 232 | + if (!empty($data)) |
|
| 233 | 233 | { |
| 234 | 234 | $user_id = $this->getUserId($data); |
| 235 | 235 | $user = $this->getUserModel()::find($user_id); |
| 236 | - if(!$user) |
|
| 236 | + if (!$user) |
|
| 237 | 237 | { |
| 238 | 238 | $this->error($msg, $from, 'There is no such user.'); |
| 239 | 239 | } |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | foreach ($required as $input) |
| 22 | 22 | { |
| 23 | - if(!in_array($input,(array)$this->request)) |
|
| 23 | + if (!in_array($input, (array) $this->request)) |
|
| 24 | 24 | { |
| 25 | - $this->error($this->request,$this->conn,$this->requireErrorMessage($input)); |
|
| 25 | + $this->error($this->request, $this->conn, $this->requireErrorMessage($input)); |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public function validate($request, array $rules, |
| 51 | 51 | array $messages = [], array $customAttributes = []) |
| 52 | 52 | { |
| 53 | - if($request instanceof Collection) |
|
| 53 | + if ($request instanceof Collection) |
|
| 54 | 54 | $request = $request->toArray(); |
| 55 | 55 | |
| 56 | 56 | return $this->getValidationFactory()->make( |