@@ -16,7 +16,7 @@ |
||
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, 'laravel'); |
21 | 21 | }); |
22 | 22 |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function make(?callable $callback = null) |
64 | 64 | { |
65 | - $mcb = function ($type, $buffer) use ($callback) { |
|
66 | - if (! $this->locked && AppProcess::OUT === $type && $event = FSEventParser::toEvent($buffer)) { |
|
65 | + $mcb = function($type, $buffer) use ($callback) { |
|
66 | + if (!$this->locked && AppProcess::OUT === $type && $event = FSEventParser::toEvent($buffer)) { |
|
67 | 67 | $this->locked = true; |
68 | 68 | ($callback) ? $callback($event) : null; |
69 | 69 | $this->locked = false; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | }; |
73 | 73 | |
74 | - return new SwooleProcess(function () use ($mcb) { |
|
74 | + return new SwooleProcess(function() use ($mcb) { |
|
75 | 75 | (new AppProcess($this->configure()))->setTimeout(0)->run($mcb); |
76 | 76 | }, false, false); |
77 | 77 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | protected function isSwooleQueuePacket($packet) |
16 | 16 | { |
17 | - if (! is_string($packet)) { |
|
17 | + if (!is_string($packet)) { |
|
18 | 18 | return false; |
19 | 19 | } |
20 | 20 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function setRedis(?RedisClient $redis = null) |
59 | 59 | { |
60 | - if (! $redis) { |
|
60 | + if (!$redis) { |
|
61 | 61 | $server = Arr::get($this->config, 'server', []); |
62 | 62 | $options = Arr::get($this->config, 'options', []); |
63 | 63 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $this->checkTable($table); |
140 | 140 | $redisKey = $this->getKey($key, $table); |
141 | 141 | |
142 | - $this->redis->pipeline(function (Pipeline $pipe) use ($redisKey, $values) { |
|
142 | + $this->redis->pipeline(function(Pipeline $pipe) use ($redisKey, $values) { |
|
143 | 143 | foreach ($values as $value) { |
144 | 144 | $pipe->sadd($redisKey, $value); |
145 | 145 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $this->checkTable($table); |
163 | 163 | $redisKey = $this->getKey($key, $table); |
164 | 164 | |
165 | - $this->redis->pipeline(function (Pipeline $pipe) use ($redisKey, $values) { |
|
165 | + $this->redis->pipeline(function(Pipeline $pipe) use ($redisKey, $values) { |
|
166 | 166 | foreach ($values as $value) { |
167 | 167 | $pipe->srem($redisKey, $value); |
168 | 168 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | protected function checkTable(string $table) |
204 | 204 | { |
205 | - if (! in_array($table, [RoomContract::ROOMS_KEY, RoomContract::DESCRIPTORS_KEY])) { |
|
205 | + if (!in_array($table, [RoomContract::ROOMS_KEY, RoomContract::DESCRIPTORS_KEY])) { |
|
206 | 206 | throw new \InvalidArgumentException("Invalid table name: `{$table}`."); |
207 | 207 | } |
208 | 208 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | foreach ($rooms as $room) { |
88 | 88 | $fds = $this->getClients($room); |
89 | 89 | |
90 | - if (! in_array($fd, $fds)) { |
|
90 | + if (!in_array($fd, $fds)) { |
|
91 | 91 | continue; |
92 | 92 | } |
93 | 93 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | protected function checkTable(string $table) |
208 | 208 | { |
209 | - if (! property_exists($this, $table) || ! $this->$table instanceof Table) { |
|
209 | + if (!property_exists($this, $table) || !$this->$table instanceof Table) { |
|
210 | 210 | throw new \InvalidArgumentException("Invalid table name: `{$table}`."); |
211 | 211 | } |
212 | 212 | } |
@@ -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; |
@@ -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 |
@@ -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 |