@@ -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 | /** |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | protected function getWebsocketConnections(): array |
235 | 235 | { |
236 | - return array_filter(iterator_to_array($this->server->connections), function ($fd) { |
|
236 | + return array_filter(iterator_to_array($this->server->connections), function($fd) { |
|
237 | 237 | return $this->isServerWebsocket($fd); |
238 | 238 | }); |
239 | 239 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | public function push($payload): void |
260 | 260 | { |
261 | 261 | // attach sender if not broadcast |
262 | - if (! $this->broadcast && $this->sender && ! $this->hasDescriptor($this->sender)) { |
|
262 | + if (!$this->broadcast && $this->sender && !$this->hasDescriptor($this->sender)) { |
|
263 | 263 | $this->addDescriptor($this->sender); |
264 | 264 | } |
265 | 265 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | foreach ($this->events as $event) { |
124 | 124 | $listener = Str::camel("on_$event"); |
125 | - $callback = method_exists($this, $listener) ? [$this, $listener] : function () use ($event) { |
|
125 | + $callback = method_exists($this, $listener) ? [$this, $listener] : function() use ($event) { |
|
126 | 126 | $this->container->make('events')->dispatch("swoole.$event", func_get_args()); |
127 | 127 | }; |
128 | 128 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | protected function bindSandbox() |
321 | 321 | { |
322 | - $this->app->singleton(Sandbox::class, function ($app) { |
|
322 | + $this->app->singleton(Sandbox::class, function($app) { |
|
323 | 323 | return new Sandbox($app, $this->framework); |
324 | 324 | }); |
325 | 325 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | */ |
441 | 441 | protected function normalizeException(Throwable $e) |
442 | 442 | { |
443 | - if (! $e instanceof Exception) { |
|
443 | + if (!$e instanceof Exception) { |
|
444 | 444 | $e = new FatalThrowableError($e); |
445 | 445 | } |
446 | 446 |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $options = $config->get('swoole_http.server.options'); |
145 | 145 | |
146 | 146 | // only enable task worker in websocket mode and for queue driver |
147 | - if ($config->get('queue.default') !== 'swoole' && ! $this->isWebsocket) { |
|
147 | + if ($config->get('queue.default') !== 'swoole' && !$this->isWebsocket) { |
|
148 | 148 | unset($config['task_worker_num']); |
149 | 149 | } |
150 | 150 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | protected function registerServer() |
160 | 160 | { |
161 | - $this->app->singleton(Server::class, function () { |
|
161 | + $this->app->singleton(Server::class, function() { |
|
162 | 162 | if (is_null(static::$server)) { |
163 | 163 | $this->createSwooleServer(); |
164 | 164 | $this->configureSwooleServer(); |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | */ |
175 | 175 | protected function registerDatabaseDriver() |
176 | 176 | { |
177 | - $this->app->extend(DatabaseManager::class, function (DatabaseManager $db) { |
|
178 | - $db->extend('mysql-coroutine', function ($config, $name) { |
|
177 | + $this->app->extend(DatabaseManager::class, function(DatabaseManager $db) { |
|
178 | + $db->extend('mysql-coroutine', function($config, $name) { |
|
179 | 179 | $config['name'] = $name; |
180 | 180 | |
181 | 181 | $connection = new MySqlConnection( |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | */ |
219 | 219 | protected function registerSwooleQueueDriver() |
220 | 220 | { |
221 | - $this->app->afterResolving('queue', function (QueueManager $manager) { |
|
222 | - $manager->addConnector('swoole', function () { |
|
221 | + $this->app->afterResolving('queue', function(QueueManager $manager) { |
|
222 | + $manager->addConnector('swoole', function() { |
|
223 | 223 | return new SwooleTaskConnector($this->app->make(Server::class)); |
224 | 224 | }); |
225 | 225 | }); |
@@ -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 | |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | |
36 | 36 | // router only exists after lumen 5.5 |
37 | 37 | if (property_exists($app, 'router')) { |
38 | - $app->router->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($app) { |
|
38 | + $app->router->group(['namespace' => 'SwooleTW\Http\Controllers'], function($app) { |
|
39 | 39 | require __DIR__ . '/../routes/lumen_routes.php'; |
40 | 40 | }); |
41 | 41 | } else { |
42 | - $app->group(['namespace' => 'App\Http\Controllers'], function ($app) { |
|
42 | + $app->group(['namespace' => 'App\Http\Controllers'], function($app) { |
|
43 | 43 | require __DIR__ . '/../routes/lumen_routes.php'; |
44 | 44 | }); |
45 | 45 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__.'/vendor/autoload.php'; |
|
3 | +require __DIR__ . '/vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | use SwooleTW\Http\Helpers\FW; |
6 | 6 | use SwooleTW\Http\Task\QueueFactory; |