@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | if (method_exists($this, $listener)) { |
| 104 | 104 | $this->container['swoole.server']->on($event, [$this, $listener]); |
| 105 | 105 | } else { |
| 106 | - $this->container['swoole.server']->on($event, function () use ($event) { |
|
| 106 | + $this->container['swoole.server']->on($event, function() use ($event) { |
|
| 107 | 107 | $event = sprintf('swoole.%s', $event); |
| 108 | 108 | |
| 109 | 109 | $this->container['events']->fire($event, func_get_args()); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // don't init laravel app in task workers |
| 147 | 147 | if ($server->taskworker) { |
| 148 | - $this->setProcessName('task process');//mark task process |
|
| 148 | + $this->setProcessName('task process'); //mark task process |
|
| 149 | 149 | return; |
| 150 | 150 | } |
| 151 | 151 | $this->setProcessName('worker process'); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | (new SwooleTaskJob($this->container, $server, $data, $taskId, $srcWorkerId))->fire(); |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | - $server->finish("$taskId finished");//if not ,don't call onFinish |
|
| 248 | + $server->finish("$taskId finished"); //if not ,don't call onFinish |
|
| 249 | 249 | } catch (Throwable $e) { |
| 250 | 250 | $this->logServerError($e); |
| 251 | 251 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | protected function bindSandbox() |
| 290 | 290 | { |
| 291 | - $this->app->singleton(Sandbox::class, function ($app) { |
|
| 291 | + $this->app->singleton(Sandbox::class, function($app) { |
|
| 292 | 292 | return new Sandbox($app, $this->framework); |
| 293 | 293 | }); |
| 294 | 294 | $this->app->alias(Sandbox::class, 'swoole.sandbox'); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $options = $config->get('swoole_http.server.options'); |
| 131 | 131 | |
| 132 | 132 | // only enable task worker in websocket mode and for queue driver |
| 133 | - if ($config->get('queue.default') !== 'swoole' && ! $this->isWebsocket) { |
|
| 133 | + if ($config->get('queue.default') !== 'swoole' && !$this->isWebsocket) { |
|
| 134 | 134 | unset($config['task_worker_num']); |
| 135 | 135 | } |
| 136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | protected function registerServer() |
| 146 | 146 | { |
| 147 | - $this->app->singleton(Server::class, function () { |
|
| 147 | + $this->app->singleton(Server::class, function() { |
|
| 148 | 148 | if (is_null(static::$server)) { |
| 149 | 149 | $this->createSwooleServer(); |
| 150 | 150 | $this->configureSwooleServer(); |
@@ -163,15 +163,15 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | protected function registerDatabaseDriver() |
| 165 | 165 | { |
| 166 | - $this->app->extend('db', function ($db) { |
|
| 167 | - $db->extend('mysql-coroutine', function ($config, $name) { |
|
| 166 | + $this->app->extend('db', function($db) { |
|
| 167 | + $db->extend('mysql-coroutine', function($config, $name) { |
|
| 168 | 168 | $config['name'] = $name; |
| 169 | 169 | |
| 170 | 170 | if (isset($config['read'])) { |
| 171 | 171 | $config = array_merge($config, $config['read']); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - $connectionRead = function () use ($config) { |
|
| 174 | + $connectionRead = function() use ($config) { |
|
| 175 | 175 | return (new MySqlConnector())->connect($config); |
| 176 | 176 | }; |
| 177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $config = array_merge($config, $config['write']); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - $connection = function () use ($config) { |
|
| 182 | + $connection = function() use ($config) { |
|
| 183 | 183 | return (new MySqlConnector())->connect($config); |
| 184 | 184 | }; |
| 185 | 185 | |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | protected function registerSwooleQueueDriver() |
| 202 | 202 | { |
| 203 | - $this->app->afterResolving('queue', function ($manager) { |
|
| 204 | - $manager->addConnector('swoole', function () { |
|
| 203 | + $this->app->afterResolving('queue', function($manager) { |
|
| 204 | + $manager->addConnector('swoole', function() { |
|
| 205 | 205 | return new SwooleTaskConnector($this->app->make(Server::class)); |
| 206 | 206 | }); |
| 207 | 207 | }); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $this->client->connect($options); |
| 58 | 58 | |
| 59 | - if (! $this->client->connected) { |
|
| 59 | + if (!$this->client->connected) { |
|
| 60 | 60 | $message = $this->client->connect_error ?: $this->client->error; |
| 61 | 61 | $errorCode = $this->client->connect_errno ?: $this->client->errno; |
| 62 | 62 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public static function checkDriver(string $driver) |
| 103 | 103 | { |
| 104 | - if (! in_array($driver, static::getAvailableDrivers())) { |
|
| 104 | + if (!in_array($driver, static::getAvailableDrivers())) { |
|
| 105 | 105 | throw new \InvalidArgumentException("{$driver} driver is not supported yet."); |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | public function commit() |
| 127 | 127 | { |
| 128 | 128 | $this->client->commit(); |
| 129 | - $this->inTransaction = false;//TODO I think it's sample to rollback, please confirm it |
|
| 129 | + $this->inTransaction = false; //TODO I think it's sample to rollback, please confirm it |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function inTransaction() |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $bindKeyMap = []; |
| 186 | 186 | $statement = preg_replace_callback( |
| 187 | 187 | '/:([a-zA-Z_]\w*?)\b/', |
| 188 | - function ($matches) use (&$i, &$bindKeyMap) { |
|
| 188 | + function($matches) use (&$i, &$bindKeyMap) { |
|
| 189 | 189 | $bindKeyMap[$matches[1]] = $i++; |
| 190 | 190 | |
| 191 | 191 | return '?'; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function bindParam($parameter, &$variable, $type = null, $maxlen = null, $driverdata = null) |
| 50 | 50 | { |
| 51 | - if (! is_string($parameter) && ! is_int($parameter)) { |
|
| 51 | + if (!is_string($parameter) && !is_int($parameter)) { |
|
| 52 | 52 | return false; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | public function bindValue($parameter, $variable, $type = null) |
| 62 | 62 | { |
| 63 | - if (! is_string($parameter) && ! is_int($parameter)) { |
|
| 63 | + if (!is_string($parameter) && !is_int($parameter)) { |
|
| 64 | 64 | return false; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | if (is_object($variable)) { |
| 68 | - if (! method_exists($variable, '__toString')) { |
|
| 68 | + if (!method_exists($variable, '__toString')) { |
|
| 69 | 69 | return false; |
| 70 | 70 | } else { |
| 71 | 71 | $variable = (string) $variable; |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function execute($inputParameters = null) |
| 88 | 88 | { |
| 89 | - if (! empty($inputParameters)) { |
|
| 89 | + if (!empty($inputParameters)) { |
|
| 90 | 90 | foreach ($inputParameters as $key => $value) { |
| 91 | 91 | $this->bindParam($key, $value); |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $inputParameters = []; |
| 96 | - if (! empty($this->statement->bindKeyMap)) { |
|
| 96 | + if (!empty($this->statement->bindKeyMap)) { |
|
| 97 | 97 | foreach ($this->statement->bindKeyMap as $nameKey => $numKey) { |
| 98 | 98 | if (isset($this->bindMap[$nameKey])) { |
| 99 | 99 | $inputParameters[$numKey] = $this->bindMap[$nameKey]; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | //if not, the DB::connection('mysql-coroutine')->transaction(func,times) won't be work well, |
| 111 | 111 | //and if one sql occur error, others will be execute success, it doesn't rollback, |
| 112 | 112 | //also please confirm it, Thank you |
| 113 | - if($result === false){ |
|
| 113 | + if ($result === false) { |
|
| 114 | 114 | throw new \PDOException($this->errorInfo(), $this->errorCode()); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $fetchArgument = null, |
| 153 | 153 | $ctorArgs = null |
| 154 | 154 | ) { |
| 155 | - if (! is_array($rawData)) { |
|
| 155 | + if (!is_array($rawData)) { |
|
| 156 | 156 | return false; |
| 157 | 157 | } |
| 158 | 158 | if (empty($rawData)) { |