@@ -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; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $options = $config->get('swoole_http.server.options'); |
150 | 150 | |
151 | 151 | // only enable task worker in websocket mode and for queue driver |
152 | - if ($config->get('queue.default') !== 'swoole' && ! $this->isWebsocket) { |
|
152 | + if ($config->get('queue.default') !== 'swoole' && !$this->isWebsocket) { |
|
153 | 153 | unset($options['task_worker_num']); |
154 | 154 | } |
155 | 155 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function registerServer() |
165 | 165 | { |
166 | - $this->app->singleton(Server::class, function () { |
|
166 | + $this->app->singleton(Server::class, function() { |
|
167 | 167 | if (is_null(static::$server)) { |
168 | 168 | $this->createSwooleServer(); |
169 | 169 | $this->configureSwooleServer(); |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | */ |
180 | 180 | protected function registerDatabaseDriver() |
181 | 181 | { |
182 | - $this->app->extend(DatabaseManager::class, function (DatabaseManager $db) { |
|
183 | - $db->extend('mysql-coroutine', function ($config, $name) { |
|
182 | + $this->app->extend(DatabaseManager::class, function(DatabaseManager $db) { |
|
183 | + $db->extend('mysql-coroutine', function($config, $name) { |
|
184 | 184 | $config['name'] = $name; |
185 | 185 | |
186 | 186 | $connection = new MySqlConnection( |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | */ |
224 | 224 | protected function registerSwooleQueueDriver() |
225 | 225 | { |
226 | - $this->app->afterResolving('queue', function (QueueManager $manager) { |
|
227 | - $manager->addConnector('swoole', function () { |
|
226 | + $this->app->afterResolving('queue', function(QueueManager $manager) { |
|
227 | + $manager->addConnector('swoole', function() { |
|
228 | 228 | return new SwooleTaskConnector($this->app->make(Server::class)); |
229 | 229 | }); |
230 | 230 | }); |
@@ -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 | } |