@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public static function dump(...$args) |
| 14 | 14 | { |
| 15 | - if (! static::$cloner instanceOf VarCloner) { |
|
| 15 | + if (!static::$cloner instanceOf VarCloner) { |
|
| 16 | 16 | static::$cloner = new VarCloner; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public static function getDumper() |
| 31 | 31 | { |
| 32 | - $dumper = defined('IN_PHPUNIT') || ! config('swoole_http.ob_output') |
|
| 32 | + $dumper = defined('IN_PHPUNIT') || !config('swoole_http.ob_output') |
|
| 33 | 33 | ? CliDumper::class |
| 34 | 34 | : HtmlDumper::class; |
| 35 | 35 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | $pid = $this->getCurrentPid(); |
| 136 | 136 | |
| 137 | - if (! $this->isRunning($pid)) { |
|
| 137 | + if (!$this->isRunning($pid)) { |
|
| 138 | 138 | $this->error("Failed! There is no swoole_http_server process running."); |
| 139 | 139 | |
| 140 | 140 | return; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | { |
| 179 | 179 | $pid = $this->getCurrentPid(); |
| 180 | 180 | |
| 181 | - if (! $this->isRunning($pid)) { |
|
| 181 | + if (!$this->isRunning($pid)) { |
|
| 182 | 182 | $this->error("Failed! There is no swoole_http_server process running."); |
| 183 | 183 | |
| 184 | 184 | return; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $isRunning = $this->killProcess($pid, SIGUSR1); |
| 190 | 190 | |
| 191 | - if (! $isRunning) { |
|
| 191 | + if (!$isRunning) { |
|
| 192 | 192 | $this->error('> failure'); |
| 193 | 193 | |
| 194 | 194 | return; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | { |
| 246 | 246 | $this->action = $this->argument('action'); |
| 247 | 247 | |
| 248 | - if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) { |
|
| 248 | + if (!in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) { |
|
| 249 | 249 | $this->error( |
| 250 | 250 | "Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'." |
| 251 | 251 | ); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $filter = Arr::get($this->config, 'hot_reload.filter'); |
| 267 | 267 | $log = Arr::get($this->config, 'hot_reload.log'); |
| 268 | 268 | |
| 269 | - $cb = function (FSEvent $event) use ($server, $log) { |
|
| 269 | + $cb = function(FSEvent $event) use ($server, $log) { |
|
| 270 | 270 | $log ? $this->info(FSOutput::format($event)) : null; |
| 271 | 271 | $server->reload(); |
| 272 | 272 | }; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | protected function isRunning($pid) |
| 285 | 285 | { |
| 286 | - if (! $pid) { |
|
| 286 | + if (!$pid) { |
|
| 287 | 287 | return false; |
| 288 | 288 | } |
| 289 | 289 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $start = time(); |
| 312 | 312 | |
| 313 | 313 | do { |
| 314 | - if (! $this->isRunning($pid)) { |
|
| 314 | + if (!$this->isRunning($pid)) { |
|
| 315 | 315 | break; |
| 316 | 316 | } |
| 317 | 317 | |
@@ -379,13 +379,13 @@ discard block |
||
| 379 | 379 | exit(1); |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - if (! extension_loaded('swoole')) { |
|
| 382 | + if (!extension_loaded('swoole')) { |
|
| 383 | 383 | $this->error('Can\'t detect Swoole extension installed.'); |
| 384 | 384 | |
| 385 | 385 | exit(1); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - if (! version_compare(swoole_version(), '4.3.1', 'ge')) { |
|
| 388 | + if (!version_compare(swoole_version(), '4.3.1', 'ge')) { |
|
| 389 | 389 | $this->error('Your Swoole version must be higher than `4.3.1`.'); |
| 390 | 390 | |
| 391 | 391 | exit(1); |
@@ -397,15 +397,15 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | protected function registerAccessLog() |
| 399 | 399 | { |
| 400 | - $this->laravel->singleton(OutputStyle::class, function () { |
|
| 400 | + $this->laravel->singleton(OutputStyle::class, function() { |
|
| 401 | 401 | return new OutputStyle($this->input, $this->output); |
| 402 | 402 | }); |
| 403 | 403 | |
| 404 | - $this->laravel->singleton(AccessOutput::class, function () { |
|
| 404 | + $this->laravel->singleton(AccessOutput::class, function() { |
|
| 405 | 405 | return new AccessOutput(new ConsoleOutput); |
| 406 | 406 | }); |
| 407 | 407 | |
| 408 | - $this->laravel->singleton(AccessLog::class, function (Container $container) { |
|
| 408 | + $this->laravel->singleton(AccessLog::class, function(Container $container) { |
|
| 409 | 409 | return new AccessLog($container->make(AccessOutput::class)); |
| 410 | 410 | }); |
| 411 | 411 | } |
@@ -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 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function shouldBroadcast(): bool |
| 211 | 211 | { |
| 212 | - return $this->broadcast && empty($this->descriptors) && ! $this->assigned; |
|
| 212 | + return $this->broadcast && empty($this->descriptors) && !$this->assigned; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | protected function getWebsocketConnections(): array |
| 223 | 223 | { |
| 224 | - return array_filter(iterator_to_array($this->server->connections), function ($fd) { |
|
| 224 | + return array_filter(iterator_to_array($this->server->connections), function($fd) { |
|
| 225 | 225 | return $this->server->isEstablished($fd); |
| 226 | 226 | }); |
| 227 | 227 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function shouldPushToDescriptor(int $fd): bool |
| 235 | 235 | { |
| 236 | - if (! $this->server->isEstablished($fd)) { |
|
| 236 | + if (!$this->server->isEstablished($fd)) { |
|
| 237 | 237 | return false; |
| 238 | 238 | } |
| 239 | 239 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | public function push($payload): void |
| 251 | 251 | { |
| 252 | 252 | // attach sender if not broadcast |
| 253 | - if (! $this->broadcast && $this->sender && ! $this->hasDescriptor($this->sender)) { |
|
| 253 | + if (!$this->broadcast && $this->sender && !$this->hasDescriptor($this->sender)) { |
|
| 254 | 254 | $this->addDescriptor($this->sender); |
| 255 | 255 | } |
| 256 | 256 | |