@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | if (method_exists($this, $listener)) { |
| 104 | 104 | $this->container['swoole.server']->on($event, [$this, $listener]); |
| 105 | 105 | } else { |
| 106 | - $this->container['swoole.server']->on($event, function () use ($event) { |
|
| 106 | + $this->container['swoole.server']->on($event, function() use ($event) { |
|
| 107 | 107 | $event = sprintf('swoole.%s', $event); |
| 108 | 108 | |
| 109 | 109 | $this->container['events']->fire($event, func_get_args()); |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | protected function bindSandbox() |
| 287 | 287 | { |
| 288 | - $this->app->singleton(Sandbox::class, function ($app) { |
|
| 288 | + $this->app->singleton(Sandbox::class, function($app) { |
|
| 289 | 289 | return new Sandbox($app, $this->framework); |
| 290 | 290 | }); |
| 291 | 291 | $this->app->alias(Sandbox::class, 'swoole.sandbox'); |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | if ($sandbox->isLaravel()) { |
| 21 | 21 | $router = $app->make('router'); |
| 22 | 22 | $request = $sandbox->getRequest(); |
| 23 | - $closure = function () use ($app, $request) { |
|
| 23 | + $closure = function() use ($app, $request) { |
|
| 24 | 24 | $this->container = $app; |
| 25 | 25 | if (is_null($request)) { |
| 26 | 26 | return; |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | protected function rebindProviderContainer($app, $provider) |
| 36 | 36 | { |
| 37 | - $closure = function () use ($app) { |
|
| 37 | + $closure = function() use ($app) { |
|
| 38 | 38 | $this->app = $app; |
| 39 | 39 | }; |
| 40 | 40 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | if ($sandbox->isLaravel()) { |
| 21 | 21 | $kernel = $app->make(Kernel::class); |
| 22 | 22 | |
| 23 | - $closure = function () use ($app) { |
|
| 23 | + $closure = function() use ($app) { |
|
| 24 | 24 | $this->app = $app; |
| 25 | 25 | }; |
| 26 | 26 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | $view = $app->make('view'); |
| 20 | 20 | |
| 21 | - $closure = function () use ($app) { |
|
| 21 | + $closure = function() use ($app) { |
|
| 22 | 22 | $this->container = $app; |
| 23 | 23 | $this->shared['app'] = $app; |
| 24 | 24 | }; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | /** |
| 4 | 4 | * This is only for `function not exists` in config/swoole_http.php. |
| 5 | 5 | */ |
| 6 | -if (! function_exists('swoole_cpu_num')) { |
|
| 6 | +if (!function_exists('swoole_cpu_num')) { |
|
| 7 | 7 | function swoole_cpu_num() |
| 8 | 8 | { |
| 9 | 9 | return; |
@@ -13,6 +13,6 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * This is only for `function not exists` in config/swoole_http.php. |
| 15 | 15 | */ |
| 16 | -if (! defined('SWOOLE_SOCK_TCP')) { |
|
| 16 | +if (!defined('SWOOLE_SOCK_TCP')) { |
|
| 17 | 17 | define('SWOOLE_SOCK_TCP', 1); |
| 18 | 18 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function __construct($app = null, $framework = null) |
| 36 | 36 | { |
| 37 | - if (! $app instanceof Container) { |
|
| 37 | + if (!$app instanceof Container) { |
|
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function initialize() |
| 104 | 104 | { |
| 105 | - if (! $this->app instanceof Container) { |
|
| 105 | + if (!$this->app instanceof Container) { |
|
| 106 | 106 | throw new SandboxException('A base app has not been set.'); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function run(Request $request) |
| 151 | 151 | { |
| 152 | - if (! $this->getSnapshot() instanceof Container) { |
|
| 152 | + if (!$this->getSnapshot() instanceof Container) { |
|
| 153 | 153 | throw new SandboxException('Sandbox is not enabled.'); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $response->sendContent(); |
| 200 | 200 | } elseif ($response instanceof SymfonyResponse) { |
| 201 | 201 | $content = $response->getContent(); |
| 202 | - } elseif (! $isFile = $response instanceof BinaryFileResponse) { |
|
| 202 | + } elseif (!$isFile = $response instanceof BinaryFileResponse) { |
|
| 203 | 203 | $content = (string) $response; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | $this->terminate($request, $response); |
| 208 | 208 | |
| 209 | 209 | // append ob content to response |
| 210 | - if (! $isFile && ob_get_length() > 0) { |
|
| 210 | + if (!$isFile && ob_get_length() > 0) { |
|
| 211 | 211 | if ($isStream) { |
| 212 | 212 | $response->output = ob_get_contents(); |
| 213 | 213 | } else { |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | */ |
| 281 | 281 | public function enable() |
| 282 | 282 | { |
| 283 | - if (! $this->config instanceof ConfigContract) { |
|
| 283 | + if (!$this->config instanceof ConfigContract) { |
|
| 284 | 284 | throw new SandboxException('Please initialize after setting base app.'); |
| 285 | 285 | } |
| 286 | 286 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $pid = $this->getPid(); |
| 108 | 108 | |
| 109 | - if (! $this->isRunning($pid)) { |
|
| 109 | + if (!$this->isRunning($pid)) { |
|
| 110 | 110 | $this->error("Failed! There is no swoole_http_server process running."); |
| 111 | 111 | exit(1); |
| 112 | 112 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | $pid = $this->getPid(); |
| 150 | 150 | |
| 151 | - if (! $this->isRunning($pid)) { |
|
| 151 | + if (!$this->isRunning($pid)) { |
|
| 152 | 152 | $this->error("Failed! There is no swoole_http_server process running."); |
| 153 | 153 | exit(1); |
| 154 | 154 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $isRunning = $this->killProcess($pid, SIGUSR1); |
| 159 | 159 | |
| 160 | - if (! $isRunning) { |
|
| 160 | + if (!$isRunning) { |
|
| 161 | 161 | $this->error('> failure'); |
| 162 | 162 | exit(1); |
| 163 | 163 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | { |
| 216 | 216 | $this->action = $this->argument('action'); |
| 217 | 217 | |
| 218 | - if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'])) { |
|
| 218 | + if (!in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'])) { |
|
| 219 | 219 | $this->error("Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'."); |
| 220 | 220 | exit(1); |
| 221 | 221 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | protected function isRunning($pid) |
| 231 | 231 | { |
| 232 | - if (! $pid) { |
|
| 232 | + if (!$pid) { |
|
| 233 | 233 | return false; |
| 234 | 234 | } |
| 235 | 235 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $start = time(); |
| 257 | 257 | |
| 258 | 258 | do { |
| 259 | - if (! $this->isRunning($pid)) { |
|
| 259 | + if (!$this->isRunning($pid)) { |
|
| 260 | 260 | break; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | if (file_exists($path)) { |
| 285 | 285 | $pid = (int) file_get_contents($path); |
| 286 | 286 | |
| 287 | - if (! $pid) { |
|
| 287 | + if (!$pid) { |
|
| 288 | 288 | $this->removePidFile(); |
| 289 | 289 | } else { |
| 290 | 290 | $this->pid = $pid; |
@@ -330,10 +330,10 @@ discard block |
||
| 330 | 330 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
| 331 | 331 | $this->error("Swoole extension doesn't support Windows OS yet."); |
| 332 | 332 | exit; |
| 333 | - } elseif (! extension_loaded('swoole')) { |
|
| 333 | + } elseif (!extension_loaded('swoole')) { |
|
| 334 | 334 | $this->error("Can't detect Swoole extension installed."); |
| 335 | 335 | exit; |
| 336 | - } elseif (! version_compare(swoole_version(), '4.0.0', 'ge')) { |
|
| 336 | + } elseif (!version_compare(swoole_version(), '4.0.0', 'ge')) { |
|
| 337 | 337 | $this->error("Your Swoole version must be higher than 4.0 to use coroutine."); |
| 338 | 338 | exit; |
| 339 | 339 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | foreach ($rooms as $room) { |
| 56 | 56 | $fds = $this->getClients($room); |
| 57 | 57 | |
| 58 | - if (! in_array($fd, $fds)) { |
|
| 58 | + if (!in_array($fd, $fds)) { |
|
| 59 | 59 | continue; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | protected function checkTable(string $table) |
| 124 | 124 | { |
| 125 | - if (! property_exists($this, $table) || ! $this->$table instanceof Table) { |
|
| 125 | + if (!property_exists($this, $table) || !$this->$table instanceof Table) { |
|
| 126 | 126 | throw new \InvalidArgumentException('Invalid table name.'); |
| 127 | 127 | } |
| 128 | 128 | } |