@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | protected function registerManager() |
18 | 18 | { |
19 | - $this->app->singleton(Manager::class, function ($app) { |
|
19 | + $this->app->singleton(Manager::class, function($app) { |
|
20 | 20 | return new Manager($app, 'laravel'); |
21 | 21 | }); |
22 | 22 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | protected function registerManager() |
19 | 19 | { |
20 | - $this->app->singleton(Manager::class, function ($app) { |
|
20 | + $this->app->singleton(Manager::class, function($app) { |
|
21 | 21 | return new Manager($app, 'lumen'); |
22 | 22 | }); |
23 | 23 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | protected function bootWebsocketRoutes() |
33 | 33 | { |
34 | 34 | $this->app->router |
35 | - ->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($router) { |
|
35 | + ->group(['namespace' => 'SwooleTW\Http\Controllers'], function($router) { |
|
36 | 36 | require __DIR__ . '/../routes/lumen_routes.php'; |
37 | 37 | }); |
38 | 38 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | // enable sandbox |
72 | 72 | $sandbox->enable(); |
73 | 73 | // check if socket.io connection established |
74 | - if (! $this->websocketHandler->onOpen($swooleRequest->fd, $illuminateRequest)) { |
|
74 | + if (!$this->websocketHandler->onOpen($swooleRequest->fd, $illuminateRequest)) { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | // trigger 'connect' websocket event |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function onClose($server, $fd, $reactorId) |
137 | 137 | { |
138 | - if (! $this->isServerWebsocket($fd) || ! $server instanceof WebsocketServer) { |
|
138 | + if (!$this->isServerWebsocket($fd) || !$server instanceof WebsocketServer) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function isWebsocketPushPacket($packet) |
165 | 165 | { |
166 | - if (! is_array($packet)) { |
|
166 | + if (!is_array($packet)) { |
|
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | { |
250 | 250 | $handlerClass = $this->container->make('config')->get('swoole_websocket.handler'); |
251 | 251 | |
252 | - if (! $handlerClass) { |
|
252 | + if (!$handlerClass) { |
|
253 | 253 | throw new WebsocketNotSetInConfigException; |
254 | 254 | } |
255 | 255 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | protected function bindRoom(): void |
312 | 312 | { |
313 | - $this->app->singleton(RoomContract::class, function (Container $app) { |
|
313 | + $this->app->singleton(RoomContract::class, function(Container $app) { |
|
314 | 314 | return $this->websocketRoom; |
315 | 315 | }); |
316 | 316 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | protected function bindWebsocket() |
324 | 324 | { |
325 | - $this->app->singleton(Websocket::class, function (Container $app) { |
|
325 | + $this->app->singleton(Websocket::class, function(Container $app) { |
|
326 | 326 | return new Websocket($app->make(RoomContract::class), new Pipeline($app)); |
327 | 327 | }); |
328 | 328 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $routePath = $this->container->make('config') |
338 | 338 | ->get('swoole_websocket.route_file'); |
339 | 339 | |
340 | - if (! file_exists($routePath)) { |
|
340 | + if (!file_exists($routePath)) { |
|
341 | 341 | $routePath = __DIR__ . '/../../routes/websocket.php'; |
342 | 342 | } |
343 | 343 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function isWebsocketPushPayload($payload): bool |
355 | 355 | { |
356 | - if (! is_array($payload)) { |
|
356 | + if (!is_array($payload)) { |
|
357 | 357 | return false; |
358 | 358 | } |
359 | 359 |
@@ -30,8 +30,8 @@ |
||
30 | 30 | */ |
31 | 31 | public function write(int $masterPid, int $managerPid): void |
32 | 32 | { |
33 | - if (! is_writable($this->pidFile) |
|
34 | - && ! is_writable(dirname($this->pidFile)) |
|
33 | + if (!is_writable($this->pidFile) |
|
34 | + && !is_writable(dirname($this->pidFile)) |
|
35 | 35 | ) { |
36 | 36 | throw new \RuntimeException( |
37 | 37 | sprintf('Pid file "%s" is not writable', $this->pidFile) |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function stop() |
135 | 135 | { |
136 | - if (! $this->isRunning()) { |
|
136 | + if (!$this->isRunning()) { |
|
137 | 137 | $this->error("Failed! There is no swoole_http_server process running."); |
138 | 138 | |
139 | 139 | return; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | protected function reload() |
175 | 175 | { |
176 | - if (! $this->isRunning()) { |
|
176 | + if (!$this->isRunning()) { |
|
177 | 177 | $this->error("Failed! There is no swoole_http_server process running."); |
178 | 178 | |
179 | 179 | return; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | $this->info('Reloading swoole_http_server...'); |
183 | 183 | |
184 | - if (! $this->killProcess(SIGUSR1)) { |
|
184 | + if (!$this->killProcess(SIGUSR1)) { |
|
185 | 185 | $this->error('> failure'); |
186 | 186 | |
187 | 187 | return; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | { |
242 | 242 | $this->action = $this->argument('action'); |
243 | 243 | |
244 | - if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) { |
|
244 | + if (!in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) { |
|
245 | 245 | $this->error( |
246 | 246 | "Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'." |
247 | 247 | ); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $filter = Arr::get($this->config, 'hot_reload.filter'); |
263 | 263 | $log = Arr::get($this->config, 'hot_reload.log'); |
264 | 264 | |
265 | - $cb = function (FSEvent $event) use ($server, $log) { |
|
265 | + $cb = function(FSEvent $event) use ($server, $log) { |
|
266 | 266 | $log ? $this->info(FSOutput::format($event)) : null; |
267 | 267 | $server->reload(); |
268 | 268 | }; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | { |
282 | 282 | $pids = $this->laravel->make(PidManager::class)->read(); |
283 | 283 | |
284 | - if (! count($pids)) { |
|
284 | + if (!count($pids)) { |
|
285 | 285 | return false; |
286 | 286 | } |
287 | 287 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $start = time(); |
316 | 316 | |
317 | 317 | do { |
318 | - if (! $this->isRunning()) { |
|
318 | + if (!$this->isRunning()) { |
|
319 | 319 | break; |
320 | 320 | } |
321 | 321 | |
@@ -345,13 +345,13 @@ discard block |
||
345 | 345 | exit(1); |
346 | 346 | } |
347 | 347 | |
348 | - if (! extension_loaded('swoole')) { |
|
348 | + if (!extension_loaded('swoole')) { |
|
349 | 349 | $this->error('Can\'t detect Swoole extension installed.'); |
350 | 350 | |
351 | 351 | exit(1); |
352 | 352 | } |
353 | 353 | |
354 | - if (! version_compare(swoole_version(), '4.3.1', 'ge')) { |
|
354 | + if (!version_compare(swoole_version(), '4.3.1', 'ge')) { |
|
355 | 355 | $this->error('Your Swoole version must be higher than `4.3.1`.'); |
356 | 356 | |
357 | 357 | exit(1); |
@@ -363,15 +363,15 @@ discard block |
||
363 | 363 | */ |
364 | 364 | protected function registerAccessLog() |
365 | 365 | { |
366 | - $this->laravel->singleton(OutputStyle::class, function () { |
|
366 | + $this->laravel->singleton(OutputStyle::class, function() { |
|
367 | 367 | return new OutputStyle($this->input, $this->output); |
368 | 368 | }); |
369 | 369 | |
370 | - $this->laravel->singleton(AccessOutput::class, function () { |
|
370 | + $this->laravel->singleton(AccessOutput::class, function() { |
|
371 | 371 | return new AccessOutput(new ConsoleOutput); |
372 | 372 | }); |
373 | 373 | |
374 | - $this->laravel->singleton(AccessLog::class, function (Container $container) { |
|
374 | + $this->laravel->singleton(AccessLog::class, function(Container $container) { |
|
375 | 375 | return new AccessLog($container->make(AccessOutput::class)); |
376 | 376 | }); |
377 | 377 | } |