@@ -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\Coroutine\Connectors\ConnectorFactory; |
| 6 | 6 | use SwooleTW\Http\Helpers\FW; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | protected function registerServer() |
| 149 | 149 | { |
| 150 | - $this->app->singleton(Server::class, function () { |
|
| 150 | + $this->app->singleton(Server::class, function() { |
|
| 151 | 151 | if (is_null(static::$server)) { |
| 152 | 152 | $this->createSwooleServer(); |
| 153 | 153 | $this->configureSwooleServer(); |
@@ -163,10 +163,10 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | protected function registerDatabaseDriver() |
| 165 | 165 | { |
| 166 | - $this->app->resolving('db', function ($db) { |
|
| 167 | - $db->extend('mysql-coroutine', function ($config, $name) { |
|
| 166 | + $this->app->resolving('db', function($db) { |
|
| 167 | + $db->extend('mysql-coroutine', function($config, $name) { |
|
| 168 | 168 | $config['name'] = $name; |
| 169 | - $connection = function () use ($config) { |
|
| 169 | + $connection = function() use ($config) { |
|
| 170 | 170 | return ConnectorFactory::make(FW::version())->connect($config); |
| 171 | 171 | }; |
| 172 | 172 | |
@@ -185,8 +185,8 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | protected function registerSwooleQueueDriver() |
| 187 | 187 | { |
| 188 | - $this->app->afterResolving('queue', function ($manager) { |
|
| 189 | - $manager->addConnector('swoole', function () { |
|
| 188 | + $this->app->afterResolving('queue', function($manager) { |
|
| 189 | + $manager->addConnector('swoole', function() { |
|
| 190 | 190 | return new SwooleTaskConnector($this->app->make(Server::class)); |
| 191 | 191 | }); |
| 192 | 192 | }); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function pushRaw($payload, $queue = null, array $options = []) |
| 57 | 57 | { |
| 58 | - return $this->swoole->task($payload, !is_numeric($queue) ? 1 : (int)$queue); |
|
| 58 | + return $this->swoole->task($payload, !is_numeric($queue) ? 1 : (int) $queue); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function later($delay, $job, $data = '', $queue = null) |
| 72 | 72 | { |
| 73 | - return Timer::after($this->secondsUntil($delay) * 1000, function () use ($job, $data, $queue) { |
|
| 73 | + return Timer::after($this->secondsUntil($delay) * 1000, function() use ($job, $data, $queue) { |
|
| 74 | 74 | return $this->push($job, $data, $queue); |
| 75 | 75 | }); |
| 76 | 76 | } |
@@ -143,7 +143,7 @@ |
||
| 143 | 143 | protected function setIlluminateResponse($illuminateResponse) |
| 144 | 144 | { |
| 145 | 145 | if (!$illuminateResponse instanceof SymfonyResponse) { |
| 146 | - $content = (string)$illuminateResponse; |
|
| 146 | + $content = (string) $illuminateResponse; |
|
| 147 | 147 | $illuminateResponse = new IlluminateResponse($content); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | public function disableFor($name) |
| 58 | 58 | { |
| 59 | - $this->except = array_merge($this->except, (array)$name); |
|
| 59 | + $this->except = array_merge($this->except, (array) $name); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -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 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $this->checkTable($table); |
| 141 | 141 | $redisKey = $this->getKey($key, $table); |
| 142 | 142 | |
| 143 | - $this->redis->pipeline(function (Pipeline $pipe) use ($redisKey, $values) { |
|
| 143 | + $this->redis->pipeline(function(Pipeline $pipe) use ($redisKey, $values) { |
|
| 144 | 144 | foreach ($values as $value) { |
| 145 | 145 | $pipe->sadd($redisKey, $value); |
| 146 | 146 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $this->checkTable($table); |
| 164 | 164 | $redisKey = $this->getKey($key, $table); |
| 165 | 165 | |
| 166 | - $this->redis->pipeline(function (Pipeline $pipe) use ($redisKey, $values) { |
|
| 166 | + $this->redis->pipeline(function(Pipeline $pipe) use ($redisKey, $values) { |
|
| 167 | 167 | foreach ($values as $value) { |
| 168 | 168 | $pipe->srem($redisKey, $value); |
| 169 | 169 | } |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | return null; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - return (int)$type; |
|
| 122 | + return (int) $type; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | protected function getFds() |
| 312 | 312 | { |
| 313 | - $fds = array_filter($this->to, function ($value) { |
|
| 313 | + $fds = array_filter($this->to, function($value) { |
|
| 314 | 314 | return is_integer($value); |
| 315 | 315 | }); |
| 316 | 316 | $rooms = array_diff($this->to, $fds); |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | { |
| 388 | 388 | $pipeline = $this->pipeline; |
| 389 | 389 | |
| 390 | - $closure = function () use ($container) { |
|
| 390 | + $closure = function() use ($container) { |
|
| 391 | 391 | $this->container = $container; |
| 392 | 392 | }; |
| 393 | 393 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | return $this->pipeline |
| 430 | 430 | ->send($request) |
| 431 | 431 | ->through($this->middleware) |
| 432 | - ->then(function ($request) { |
|
| 432 | + ->then(function($request) { |
|
| 433 | 433 | return $request; |
| 434 | 434 | }); |
| 435 | 435 | } |