@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function bindParam($parameter, &$variable, $type = null, $maxlen = null, $driverdata = null) |
| 56 | 56 | { |
| 57 | - if (! is_string($parameter) && ! is_int($parameter)) { |
|
| 57 | + if (!is_string($parameter) && !is_int($parameter)) { |
|
| 58 | 58 | return false; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function bindValue($parameter, $variable, $type = null) |
| 68 | 68 | { |
| 69 | - if (! is_string($parameter) && ! is_int($parameter)) { |
|
| 69 | + if (!is_string($parameter) && !is_int($parameter)) { |
|
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if (is_object($variable)) { |
| 74 | - if (! method_exists($variable, '__toString')) { |
|
| 74 | + if (!method_exists($variable, '__toString')) { |
|
| 75 | 75 | return false; |
| 76 | 76 | } else { |
| 77 | 77 | $variable = (string) $variable; |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function execute($inputParameters = null) |
| 94 | 94 | { |
| 95 | - if (! empty($inputParameters)) { |
|
| 95 | + if (!empty($inputParameters)) { |
|
| 96 | 96 | foreach ($inputParameters as $key => $value) { |
| 97 | 97 | $this->bindParam($key, $value); |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $inputParameters = []; |
| 102 | - if (! empty($this->statement->bindKeyMap)) { |
|
| 102 | + if (!empty($this->statement->bindKeyMap)) { |
|
| 103 | 103 | foreach ($this->statement->bindKeyMap as $nameKey => $numKey) { |
| 104 | 104 | if (isset($this->bindMap[$nameKey])) { |
| 105 | 105 | $inputParameters[$numKey] = $this->bindMap[$nameKey]; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $ctorArgs = null |
| 157 | 157 | ) |
| 158 | 158 | { |
| 159 | - if (! is_array($rawData)) { |
|
| 159 | + if (!is_array($rawData)) { |
|
| 160 | 160 | return false; |
| 161 | 161 | } |
| 162 | 162 | if (empty($rawData)) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $this->client->connect($options); |
| 76 | 76 | |
| 77 | - if (! $this->client->connected) { |
|
| 77 | + if (!$this->client->connected) { |
|
| 78 | 78 | $message = $this->client->connect_error ?: $this->client->error; |
| 79 | 79 | $errorCode = $this->client->connect_errno ?: $this->client->errno; |
| 80 | 80 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public static function checkDriver(string $driver) |
| 132 | 132 | { |
| 133 | - if (! in_array($driver, static::getAvailableDrivers())) { |
|
| 133 | + if (!in_array($driver, static::getAvailableDrivers())) { |
|
| 134 | 134 | throw new \InvalidArgumentException("{$driver} driver is not supported yet."); |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | if (strpos($statement, ':') !== false) { |
| 253 | 253 | $i = 0; |
| 254 | 254 | $bindKeyMap = []; |
| 255 | - $statement = preg_replace_callback('/:([a-zA-Z_]\w*?)\b/', function ($matches) use (&$i, &$bindKeyMap) { |
|
| 255 | + $statement = preg_replace_callback('/:([a-zA-Z_]\w*?)\b/', function($matches) use (&$i, &$bindKeyMap) { |
|
| 256 | 256 | $bindKeyMap[$matches[1]] = $i++; |
| 257 | 257 | |
| 258 | 258 | return '?'; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | /** |
| 4 | 4 | * This is only for `function not exists` in config/swoole_http.php. |
| 5 | 5 | */ |
| 6 | -if (! function_exists('swoole_cpu_num')) { |
|
| 6 | +if (!function_exists('swoole_cpu_num')) { |
|
| 7 | 7 | function swoole_cpu_num(): int |
| 8 | 8 | { |
| 9 | 9 | return 1; |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * This is only for `function not exists` in config/swoole_http.php. |
| 15 | 15 | */ |
| 16 | -if (! defined('SWOOLE_SOCK_TCP')) { |
|
| 16 | +if (!defined('SWOOLE_SOCK_TCP')) { |
|
| 17 | 17 | define('SWOOLE_SOCK_TCP', 1); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if (! defined('SWOOLE_PROCESS')) { |
|
| 20 | +if (!defined('SWOOLE_PROCESS')) { |
|
| 21 | 21 | define('SWOOLE_PROCESS', 3); |
| 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 | } |
@@ -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 | |
@@ -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; |