@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $this->sandbox->enable(); |
66 | 66 | $application = $this->sandbox->getLaravelApp(); |
67 | 67 | // check if socket.io connection established |
68 | - if (! $this->websocketHandler->onOpen($swooleRequest->fd, $illuminateRequest)) { |
|
68 | + if (!$this->websocketHandler->onOpen($swooleRequest->fd, $illuminateRequest)) { |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | // trigger 'connect' websocket event |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function onClose(Server $server, $fd, $reactorId) |
131 | 131 | { |
132 | - if (! $this->isWebsocket($fd)) { |
|
132 | + if (!$this->isWebsocket($fd)) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | $message = $this->parser->encode($event, $message); |
161 | 161 | |
162 | 162 | // attach sender if not broadcast |
163 | - if (! $broadcast && $sender && ! in_array($sender, $fds)) { |
|
163 | + if (!$broadcast && $sender && !in_array($sender, $fds)) { |
|
164 | 164 | $fds[] = $sender; |
165 | 165 | } |
166 | 166 | |
167 | 167 | // check if to broadcast all clients |
168 | - if ($broadcast && empty($fds) && ! $assigned) { |
|
168 | + if ($broadcast && empty($fds) && !$assigned) { |
|
169 | 169 | foreach ($server->connections as $fd) { |
170 | 170 | if ($this->isWebsocket($fd)) { |
171 | 171 | $fds[] = $fd; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | // push message to designated fds |
177 | 177 | foreach ($fds as $fd) { |
178 | - if (($broadcast && $sender === (integer) $fd) || ! $server->exist($fd)) { |
|
178 | + if (($broadcast && $sender === (integer) $fd) || !$server->exist($fd)) { |
|
179 | 179 | continue; |
180 | 180 | } |
181 | 181 | $server->push($fd, $message, $opcode); |
@@ -219,13 +219,13 @@ discard block |
||
219 | 219 | { |
220 | 220 | $handlerClass = $this->container['config']->get('swoole_websocket.handler'); |
221 | 221 | |
222 | - if (! $handlerClass) { |
|
222 | + if (!$handlerClass) { |
|
223 | 223 | throw new Exception('websocket handler not set in swoole_websocket config'); |
224 | 224 | } |
225 | 225 | |
226 | 226 | $handler = $this->app->make($handlerClass); |
227 | 227 | |
228 | - if (! $handler instanceof HandlerContract) { |
|
228 | + if (!$handler instanceof HandlerContract) { |
|
229 | 229 | throw new Exception(sprintf('%s must implement %s', get_class($handler), HandlerContract::class)); |
230 | 230 | } |
231 | 231 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | protected function bindRoom() |
252 | 252 | { |
253 | - $this->app->singleton(RoomContract::class, function ($app) { |
|
253 | + $this->app->singleton(RoomContract::class, function($app) { |
|
254 | 254 | return $this->websocketRoom; |
255 | 255 | }); |
256 | 256 | $this->app->alias(RoomContract::class, 'swoole.room'); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | */ |
262 | 262 | protected function bindWebsocket() |
263 | 263 | { |
264 | - $this->app->singleton(Websocket::class, function ($app) { |
|
264 | + $this->app->singleton(Websocket::class, function($app) { |
|
265 | 265 | return $this->websocket = new Websocket($app['swoole.room'], new Pipeline); |
266 | 266 | }); |
267 | 267 | $this->app->alias(Websocket::class, 'swoole.websocket'); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | { |
275 | 275 | $routePath = $this->container['config']->get('swoole_websocket.route_file'); |
276 | 276 | |
277 | - if (! file_exists($routePath)) { |
|
277 | + if (!file_exists($routePath)) { |
|
278 | 278 | $routePath = __DIR__ . '/../../routes/websocket.php'; |
279 | 279 | } |
280 | 280 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | */ |
10 | 10 | protected function bindSwooleTask() |
11 | 11 | { |
12 | - $this->app->singleton('swoole.task', function () { |
|
12 | + $this->app->singleton('swoole.task', function() { |
|
13 | 13 | return new SwooleTask($this); |
14 | 14 | }); |
15 | 15 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | /** |
6 | 6 | * This is only for `function not exists` in config/swoole_http.php. |
7 | 7 | */ |
8 | -if (! function_exists('swoole_cpu_num')) { |
|
8 | +if (!function_exists('swoole_cpu_num')) { |
|
9 | 9 | function swoole_cpu_num() |
10 | 10 | { |
11 | 11 | return; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | |
16 | -if (! function_exists('swoole_async_task')) { |
|
16 | +if (!function_exists('swoole_async_task')) { |
|
17 | 17 | /** |
18 | 18 | * Swoole Async task helper. |
19 | 19 | * |