@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | protected function registerManager() |
| 15 | 15 | { |
| 16 | - $this->app->singleton('swoole.manager', function ($app) { |
|
| 16 | + $this->app->singleton('swoole.manager', function($app) { |
|
| 17 | 17 | return new Manager($app, 'lumen'); |
| 18 | 18 | }); |
| 19 | 19 | } |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | $app = $this->app; |
| 29 | 29 | |
| 30 | 30 | if (property_exists($app, 'router')) { |
| 31 | - $app->router->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($app) { |
|
| 31 | + $app->router->group(['namespace' => 'SwooleTW\Http\Controllers'], function($app) { |
|
| 32 | 32 | require __DIR__ . '/../routes/lumen_routes.php'; |
| 33 | 33 | }); |
| 34 | 34 | } else { |
| 35 | - $app->group(['namespace' => 'App\Http\Controllers'], function ($app) { |
|
| 35 | + $app->group(['namespace' => 'App\Http\Controllers'], function($app) { |
|
| 36 | 36 | require __DIR__ . '/../routes/lumen_routes.php'; |
| 37 | 37 | }); |
| 38 | 38 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $pid = $this->getPid(); |
| 104 | 104 | |
| 105 | - if (! $this->isRunning($pid)) { |
|
| 105 | + if (!$this->isRunning($pid)) { |
|
| 106 | 106 | $this->error("Failed! There is no swoole_http_server process running."); |
| 107 | 107 | exit(1); |
| 108 | 108 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | { |
| 145 | 145 | $pid = $this->getPid(); |
| 146 | 146 | |
| 147 | - if (! $this->isRunning($pid)) { |
|
| 147 | + if (!$this->isRunning($pid)) { |
|
| 148 | 148 | $this->error("Failed! There is no swoole_http_server process running."); |
| 149 | 149 | exit(1); |
| 150 | 150 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $isRunning = $this->killProcess($pid, SIGUSR1); |
| 155 | 155 | |
| 156 | - if (! $isRunning) { |
|
| 156 | + if (!$isRunning) { |
|
| 157 | 157 | $this->error('> failure'); |
| 158 | 158 | exit(1); |
| 159 | 159 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | $this->action = $this->argument('action'); |
| 213 | 213 | |
| 214 | - if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'])) { |
|
| 214 | + if (!in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'])) { |
|
| 215 | 215 | $this->error("Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'."); |
| 216 | 216 | exit(1); |
| 217 | 217 | } |
@@ -225,13 +225,13 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | protected function isRunning($pid) |
| 227 | 227 | { |
| 228 | - if (! $pid) { |
|
| 228 | + if (!$pid) { |
|
| 229 | 229 | return false; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | Process::kill($pid, 0); |
| 233 | 233 | |
| 234 | - return ! swoole_errno(); |
|
| 234 | + return !swoole_errno(); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $start = time(); |
| 251 | 251 | |
| 252 | 252 | do { |
| 253 | - if (! $this->isRunning($pid)) { |
|
| 253 | + if (!$this->isRunning($pid)) { |
|
| 254 | 254 | break; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | if (file_exists($path)) { |
| 279 | 279 | $pid = (int) file_get_contents($path); |
| 280 | 280 | |
| 281 | - if (! $pid) { |
|
| 281 | + if (!$pid) { |
|
| 282 | 282 | $this->removePidFile(); |
| 283 | 283 | } else { |
| 284 | 284 | $this->pid = $pid; |
@@ -323,11 +323,11 @@ discard block |
||
| 323 | 323 | { |
| 324 | 324 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
| 325 | 325 | throw new \RuntimeException("Swoole extension doesn't support Windows OS yet."); |
| 326 | - } elseif (! extension_loaded('swoole')) { |
|
| 326 | + } elseif (!extension_loaded('swoole')) { |
|
| 327 | 327 | throw new \RuntimeException("Can't detect Swoole extension installed."); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if (! version_compare(swoole_version(), '4.0.0-alpha', 'ge')) { |
|
| 330 | + if (!version_compare(swoole_version(), '4.0.0-alpha', 'ge')) { |
|
| 331 | 331 | throw new \RuntimeException("Your Swoole version must be higher than 4.0 to use coroutine."); |
| 332 | 332 | } |
| 333 | 333 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $key = str_replace('-', '_', $key); |
| 152 | 152 | $key = strtoupper($key); |
| 153 | 153 | |
| 154 | - if (! in_array($key, ['REMOTE_ADDR', 'SERVER_PORT', 'HTTPS'])) { |
|
| 154 | + if (!in_array($key, ['REMOTE_ADDR', 'SERVER_PORT', 'HTTPS'])) { |
|
| 155 | 155 | $key = 'HTTP_' . $key; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $filename = $publicPath . $uri; |
| 181 | - if (! is_file($filename) || filesize($filename) === 0) { |
|
| 181 | + if (!is_file($filename) || filesize($filename) === 0) { |
|
| 182 | 182 | return; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $illuminateResponse = $this->getIlluminateResponse(); |
| 66 | 66 | |
| 67 | 67 | /* RFC2616 - 14.18 says all Responses need to have a Date */ |
| 68 | - if (! $illuminateResponse->headers->has('Date')) { |
|
| 68 | + if (!$illuminateResponse->headers->has('Date')) { |
|
| 69 | 69 | $illuminateResponse->setDate(\DateTime::createFromFormat('U', time())); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | protected function setIlluminateResponse($illuminateResponse) |
| 141 | 141 | { |
| 142 | - if (! $illuminateResponse instanceof SymfonyResponse) { |
|
| 142 | + if (!$illuminateResponse instanceof SymfonyResponse) { |
|
| 143 | 143 | $content = (string) $illuminateResponse; |
| 144 | 144 | $illuminateResponse = new IlluminateResponse($content); |
| 145 | 145 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $config = $this->app['config']->get('swoole_http.server.options'); |
| 131 | 131 | |
| 132 | 132 | // only enable task worker in websocket mode |
| 133 | - if (! $this->isWebsocket) { |
|
| 133 | + if (!$this->isWebsocket) { |
|
| 134 | 134 | unset($config['task_worker_num']); |
| 135 | 135 | } |
| 136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | protected function registerServer() |
| 146 | 146 | { |
| 147 | - $this->app->singleton(Server::class, function () { |
|
| 147 | + $this->app->singleton(Server::class, function() { |
|
| 148 | 148 | return static::$server; |
| 149 | 149 | }); |
| 150 | 150 | $this->app->alias(Server::class, 'swoole.server'); |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | protected function registerDatabaseDriver() |
| 157 | 157 | { |
| 158 | - $this->app->resolving('db', function ($db) { |
|
| 159 | - $db->extend('mysql-coroutine', function ($config, $name) { |
|
| 158 | + $this->app->resolving('db', function($db) { |
|
| 159 | + $db->extend('mysql-coroutine', function($config, $name) { |
|
| 160 | 160 | $config['name'] = $name; |
| 161 | - $connection = function () use ($config) { |
|
| 161 | + $connection = function() use ($config) { |
|
| 162 | 162 | return (new MySqlConnector())->connect($config); |
| 163 | 163 | }; |
| 164 | 164 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | protected function rebindProviderContainer($app, $provider) |
| 53 | 53 | { |
| 54 | - $closure = function () use ($app) { |
|
| 54 | + $closure = function() use ($app) { |
|
| 55 | 55 | $this->app = $app; |
| 56 | 56 | }; |
| 57 | 57 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | if ($this->isLaravel()) { |
| 101 | 101 | $router = $app->make('router'); |
| 102 | 102 | $request = $this->getRequest(); |
| 103 | - $closure = function () use ($app, $request) { |
|
| 103 | + $closure = function() use ($app, $request) { |
|
| 104 | 104 | $this->container = $app; |
| 105 | 105 | if (is_null($request)) { |
| 106 | 106 | return; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | $view = $app->make('view'); |
| 137 | 137 | |
| 138 | - $closure = function () use ($app) { |
|
| 138 | + $closure = function() use ($app) { |
|
| 139 | 139 | $this->container = $app; |
| 140 | 140 | $this->shared['app'] = $app; |
| 141 | 141 | }; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | if ($this->isLaravel()) { |
| 153 | 153 | $kernel = $app->make(Kernel::class); |
| 154 | 154 | |
| 155 | - $closure = function () use ($app) { |
|
| 155 | + $closure = function() use ($app) { |
|
| 156 | 156 | $this->app = $app; |
| 157 | 157 | }; |
| 158 | 158 | |