@@ -53,7 +53,7 @@ |
||
53 | 53 | new Receiver() |
54 | 54 | ) |
55 | 55 | ), |
56 | - env('CHAT_PORT',8080) |
|
56 | + env('CHAT_PORT', 8080) |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | $server->run(); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | class WsRoute extends \Illuminate\Support\Facades\Facade |
12 | 12 | { |
13 | - static function getFacadeAccessor(){ |
|
13 | + static function getFacadeAccessor() { |
|
14 | 14 | |
15 | 15 | return 'WsRoute'; |
16 | 16 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | function hasMember($client) |
46 | 46 | { |
47 | - if(array_key_exists($client->id,$this->members)) |
|
47 | + if (array_key_exists($client->id, $this->members)) |
|
48 | 48 | return true; |
49 | 49 | |
50 | 50 | return false; |
@@ -19,9 +19,9 @@ |
||
19 | 19 | { |
20 | 20 | foreach ($required as $input) |
21 | 21 | { |
22 | - if(!in_array($input,(array)$this->request)) |
|
22 | + if (!in_array($input, (array) $this->request)) |
|
23 | 23 | { |
24 | - $this->error($this->request,$this->conn,$this->requireErrorMessage($input)); |
|
24 | + $this->error($this->request, $this->conn, $this->requireErrorMessage($input)); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | class WebSocketController |
24 | 24 | { |
25 | - use WebSocketMessagesManager,Validation; |
|
25 | + use WebSocketMessagesManager, Validation; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @var Client[] |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | */ |
21 | 21 | function enterRoom() |
22 | 22 | { |
23 | - $this->validate($this->request,[ |
|
23 | + $this->validate($this->request, [ |
|
24 | 24 | 'room_id'=>'required' |
25 | 25 | ]); |
26 | - $room_id =$this->request->room_id; |
|
26 | + $room_id = $this->request->room_id; |
|
27 | 27 | |
28 | - $this->validateRoom($room_id,true); |
|
28 | + $this->validateRoom($room_id, true); |
|
29 | 29 | |
30 | 30 | $this->addMember($room_id); |
31 | 31 | } |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | function exitRoom() |
37 | 37 | { |
38 | 38 | |
39 | - $this->validate($this->request,[ |
|
39 | + $this->validate($this->request, [ |
|
40 | 40 | 'room_id'=>'required' |
41 | 41 | ]); |
42 | - $room_id =$this->request->room_id; |
|
42 | + $room_id = $this->request->room_id; |
|
43 | 43 | |
44 | 44 | $this->validateRoom($room_id); |
45 | 45 |
@@ -18,6 +18,6 @@ |
||
18 | 18 | function index() |
19 | 19 | { |
20 | 20 | echo 'Initializing ..'; |
21 | - $this->sendBack(['message'=>'WebSocket Initialized','event'=>'initialize']); |
|
21 | + $this->sendBack(['message'=>'WebSocket Initialized', 'event'=>'initialize']); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $this->publishes([ |
29 | 29 | __DIR__.'/config' => realpath('config'), |
30 | 30 | __DIR__.'/Routes/published' => realpath('routes'), |
31 | - ],'laravel-ratchet'); |
|
31 | + ], 'laravel-ratchet'); |
|
32 | 32 | |
33 | 33 | if ($this->app['config']->get('laravel-ratchet') === null) { |
34 | 34 | $this->app['config']->set('laravel-ratchet', require __DIR__.'/config/laravel-ratchet.php'); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function register() |
44 | 44 | { |
45 | - $this->app->bind('WsRoute',function (){ |
|
45 | + $this->app->bind('WsRoute', function() { |
|
46 | 46 | return new Routes(); |
47 | 47 | }); |
48 | 48 | } |
@@ -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 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | $this->resetSession($msg->session); |
76 | 76 | |
77 | - $this->resetAuth($msg,$from); |
|
77 | + $this->resetAuth($msg, $from); |
|
78 | 78 | |
79 | 79 | $route = $this->routes[$msg->route]; |
80 | 80 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if ($data = \Session::getHandler()->read($session_id)) { |
179 | 179 | $data = @unserialize($data); |
180 | 180 | |
181 | - if ($data !== false && ! is_null($data) && is_array($data)) { |
|
181 | + if ($data !== false && !is_null($data) && is_array($data)) { |
|
182 | 182 | return $data; |
183 | 183 | } |
184 | 184 | } |
@@ -210,17 +210,17 @@ discard block |
||
210 | 210 | * @param ConnectionInterface $from |
211 | 211 | * @throws WebSocketException |
212 | 212 | */ |
213 | - function resetAuth($msg,$from) |
|
213 | + function resetAuth($msg, $from) |
|
214 | 214 | { |
215 | 215 | $data = $this->readFromHandler($msg->session); |
216 | 216 | |
217 | - if(!empty($data)) |
|
217 | + if (!empty($data)) |
|
218 | 218 | { |
219 | 219 | $user_id = $this->getUserId($data); |
220 | 220 | /** @var User $user_model */ |
221 | 221 | $user_model = $this->getUserModel(); |
222 | 222 | $user = $user_model::find($user_id); |
223 | - if(!$user) |
|
223 | + if (!$user) |
|
224 | 224 | { |
225 | 225 | $this->error($msg, $from, 'There is no such user.'); |
226 | 226 | } |