@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | protected function startSession(Request $request) |
| 62 | 62 | { |
| 63 | - return tap($this->getSession($request), function (Session $session) use ($request) { |
|
| 63 | + return tap($this->getSession($request), function(Session $session) use ($request) { |
|
| 64 | 64 | $session->setRequestOnHandler($request); |
| 65 | 65 | |
| 66 | 66 | $session->start(); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function getSession(Request $request) |
| 78 | 78 | { |
| 79 | - return tap($this->manager->driver(), function (Session $session) use ($request) { |
|
| 79 | + return tap($this->manager->driver(), function(Session $session) use ($request) { |
|
| 80 | 80 | $session->setId($request->cookies->get($session->getName())); |
| 81 | 81 | }); |
| 82 | 82 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 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, 'lumen'); |
| 21 | 21 | }); |
| 22 | 22 | |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | $app = $this->app; |
| 34 | 34 | |
| 35 | 35 | if (property_exists($app, 'router')) { |
| 36 | - $app->router->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($app) { |
|
| 36 | + $app->router->group(['namespace' => 'SwooleTW\Http\Controllers'], function($app) { |
|
| 37 | 37 | require __DIR__ . '/../routes/lumen_routes.php'; |
| 38 | 38 | }); |
| 39 | 39 | } else { |
| 40 | - $app->group(['namespace' => 'App\Http\Controllers'], function ($app) { |
|
| 40 | + $app->group(['namespace' => 'App\Http\Controllers'], function($app) { |
|
| 41 | 41 | require __DIR__ . '/../routes/lumen_routes.php'; |
| 42 | 42 | }); |
| 43 | 43 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $options = $config->get('swoole_http.server.options'); |
| 146 | 146 | |
| 147 | 147 | // only enable task worker in websocket mode and for queue driver |
| 148 | - if ($config->get('queue.default') !== 'swoole' && ! $this->isWebsocket) { |
|
| 148 | + if ($config->get('queue.default') !== 'swoole' && !$this->isWebsocket) { |
|
| 149 | 149 | unset($config['task_worker_num']); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | protected function registerServer() |
| 161 | 161 | { |
| 162 | - $this->app->singleton(Server::class, function () { |
|
| 162 | + $this->app->singleton(Server::class, function() { |
|
| 163 | 163 | if (is_null(static::$server)) { |
| 164 | 164 | $this->createSwooleServer(); |
| 165 | 165 | $this->configureSwooleServer(); |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | protected function registerDatabaseDriver() |
| 177 | 177 | { |
| 178 | - $this->app->extend(DatabaseManager::class, function (DatabaseManager $db) { |
|
| 179 | - $db->extend('mysql-coroutine', function ($config, $name) { |
|
| 178 | + $this->app->extend(DatabaseManager::class, function(DatabaseManager $db) { |
|
| 179 | + $db->extend('mysql-coroutine', function($config, $name) { |
|
| 180 | 180 | $config = $this->getMergedDatabaseConfig($config, $name); |
| 181 | 181 | |
| 182 | 182 | $connection = new MySqlConnection( |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | protected function registerSwooleQueueDriver() |
| 234 | 234 | { |
| 235 | - $this->app->afterResolving('queue', function (QueueManager $manager) { |
|
| 236 | - $manager->addConnector('swoole', function () { |
|
| 235 | + $this->app->afterResolving('queue', function(QueueManager $manager) { |
|
| 236 | + $manager->addConnector('swoole', function() { |
|
| 237 | 237 | return new SwooleTaskConnector($this->app->make(Server::class)); |
| 238 | 238 | }); |
| 239 | 239 | }); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function pushRaw($payload, $queue = null, array $options = []) |
| 56 | 56 | { |
| 57 | - return $this->swoole->task($payload, ! is_numeric($queue) ? -1 : (int)$queue); |
|
| 57 | + return $this->swoole->task($payload, !is_numeric($queue) ? -1 : (int) $queue); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function later($delay, $job, $data = '', $queue = null) |
| 71 | 71 | { |
| 72 | - return Timer::after($this->secondsUntil($delay) * 1000, function () use ($job, $data, $queue) { |
|
| 72 | + return Timer::after($this->secondsUntil($delay) * 1000, function() use ($job, $data, $queue) { |
|
| 73 | 73 | return $this->push($job, $data, $queue); |
| 74 | 74 | }); |
| 75 | 75 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public static function make($server, string $version): SwooleTaskQueue |
| 42 | 42 | { |
| 43 | 43 | $isMatch = static::isFileVersionMatch($version); |
| 44 | - $class = static::copy(static::stub($version), ! $isMatch); |
|
| 44 | + $class = static::copy(static::stub($version), !$isMatch); |
|
| 45 | 45 | |
| 46 | 46 | return new $class($server); |
| 47 | 47 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public static function copy(string $stub, bool $rewrite = false): string |
| 68 | 68 | { |
| 69 | - if (! file_exists(static::QUEUE_CLASS_PATH) || $rewrite) { |
|
| 69 | + if (!file_exists(static::QUEUE_CLASS_PATH) || $rewrite) { |
|
| 70 | 70 | copy($stub, static::QUEUE_CLASS_PATH); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function upgrade(Request $request) |
| 13 | 13 | { |
| 14 | - if (! in_array($request->input('transport'), $this->transports)) { |
|
| 14 | + if (!in_array($request->input('transport'), $this->transports)) { |
|
| 15 | 15 | return response()->json( |
| 16 | 16 | [ |
| 17 | 17 | 'code' => 0, |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $key = str_replace('-', '_', $key); |
| 159 | 159 | $key = strtoupper($key); |
| 160 | 160 | |
| 161 | - if (! in_array($key, ['REMOTE_ADDR', 'SERVER_PORT', 'HTTPS'])) { |
|
| 161 | + if (!in_array($key, ['REMOTE_ADDR', 'SERVER_PORT', 'HTTPS'])) { |
|
| 162 | 162 | $key = 'HTTP_' . $key; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | return false; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - if (! is_file($fileName) || ! filesize($fileName)) { |
|
| 190 | + if (!is_file($fileName) || !filesize($fileName)) { |
|
| 191 | 191 | return false; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -189,7 +189,7 @@ |
||
| 189 | 189 | */ |
| 190 | 190 | public function isBroadcastToAllDescriptors(): bool |
| 191 | 191 | { |
| 192 | - return $this->isBroadcast() && ! $this->isAssigned() && count($this->descriptors) > 0; |
|
| 192 | + return $this->isBroadcast() && !$this->isAssigned() && count($this->descriptors) > 0; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function onOpen($fd, Request $request) |
| 23 | 23 | { |
| 24 | - if (! $request->input('sid')) { |
|
| 24 | + if (!$request->input('sid')) { |
|
| 25 | 25 | $payload = json_encode( |
| 26 | 26 | [ |
| 27 | 27 | 'sid' => base64_encode(uniqid()), |