@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | { |
117 | 117 | if ($this->snapshot instanceOf Application) { |
118 | 118 | return $this->snapshot; |
119 | - } elseif (! $this->enabled) { |
|
119 | + } elseif (!$this->enabled) { |
|
120 | 120 | throw new SandboxException('Sandbox is not enabled yet.'); |
121 | 121 | } |
122 | 122 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | protected function rebindProviderContainer($provider, $application) |
182 | 182 | { |
183 | - $closure = function () use ($application) { |
|
183 | + $closure = function() use ($application) { |
|
184 | 184 | $this->app = $application; |
185 | 185 | }; |
186 | 186 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | if ($this->isFramework('laravel')) { |
229 | 229 | $router = $application->make('router'); |
230 | 230 | $request = $this->request; |
231 | - $closure = function () use ($application, $request) { |
|
231 | + $closure = function() use ($application, $request) { |
|
232 | 232 | $this->container = $application; |
233 | 233 | if (is_null($request)) { |
234 | 234 | return; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | { |
260 | 260 | $view = $application->make('view'); |
261 | 261 | |
262 | - $closure = function () use ($application) { |
|
262 | + $closure = function() use ($application) { |
|
263 | 263 | $this->container = $application; |
264 | 264 | $this->shared['app'] = $application; |
265 | 265 | }; |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public function disable() |
307 | 307 | { |
308 | - if (! $this->enabled) { |
|
308 | + if (!$this->enabled) { |
|
309 | 309 | return; |
310 | 310 | } |
311 | 311 |
@@ -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 |