@@ -3,7 +3,7 @@ |
||
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() |
8 | 8 | { |
9 | 9 | return; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $illuminateResponse = $this->getIlluminateResponse(); |
66 | 66 | |
67 | 67 | /* RFC2616 - 14.18 says all Responses need to have a Date */ |
68 | - if (! $illuminateResponse->headers->has('Date')) { |
|
68 | + if (!$illuminateResponse->headers->has('Date')) { |
|
69 | 69 | $illuminateResponse->setDate(\DateTime::createFromFormat('U', time())); |
70 | 70 | } |
71 | 71 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function setIlluminateResponse($illuminateResponse) |
141 | 141 | { |
142 | - if (! $illuminateResponse instanceof SymfonyResponse) { |
|
142 | + if (!$illuminateResponse instanceof SymfonyResponse) { |
|
143 | 143 | $content = (string) $illuminateResponse; |
144 | 144 | $illuminateResponse = new IlluminateResponse($content); |
145 | 145 | } |
@@ -148,7 +148,7 @@ |
||
148 | 148 | $key = str_replace('-', '_', $key); |
149 | 149 | $key = strtoupper($key); |
150 | 150 | |
151 | - if (! in_array($key, ['REMOTE_ADDR', 'SERVER_PORT', 'HTTPS'])) { |
|
151 | + if (!in_array($key, ['REMOTE_ADDR', 'SERVER_PORT', 'HTTPS'])) { |
|
152 | 152 | $key = 'HTTP_' . $key; |
153 | 153 | } |
154 | 154 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | protected function bindSwooleTable() |
51 | 51 | { |
52 | - $this->app->singleton('swoole.table', function () { |
|
52 | + $this->app->singleton('swoole.table', function() { |
|
53 | 53 | return $this->table; |
54 | 54 | }); |
55 | 55 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | protected function registerManager() |
15 | 15 | { |
16 | - $this->app->singleton('swoole.http', function ($app) { |
|
16 | + $this->app->singleton('swoole.http', function($app) { |
|
17 | 17 | return new Manager($app, 'laravel'); |
18 | 18 | }); |
19 | 19 | } |
@@ -25,6 +25,6 @@ discard block |
||
25 | 25 | */ |
26 | 26 | protected function bootRoutes() |
27 | 27 | { |
28 | - require __DIR__.'/../routes/laravel_routes.php'; |
|
28 | + require __DIR__ . '/../routes/laravel_routes.php'; |
|
29 | 29 | } |
30 | 30 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | protected function registerManager() |
15 | 15 | { |
16 | - $this->app->singleton('swoole.http', function ($app) { |
|
16 | + $this->app->singleton('swoole.http', function($app) { |
|
17 | 17 | return new Manager($app, 'lumen'); |
18 | 18 | }); |
19 | 19 | } |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | $app = $this->app; |
29 | 29 | |
30 | 30 | if (property_exists($app, 'router')) { |
31 | - $app->router->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($app) { |
|
31 | + $app->router->group(['namespace' => 'SwooleTW\Http\Controllers'], function($app) { |
|
32 | 32 | require __DIR__ . '/../routes/lumen_routes.php'; |
33 | 33 | }); |
34 | 34 | } else { |
35 | - $app->group(['namespace' => 'App\Http\Controllers'], function ($app) { |
|
35 | + $app->group(['namespace' => 'App\Http\Controllers'], function($app) { |
|
36 | 36 | require __DIR__ . '/../routes/lumen_routes.php'; |
37 | 37 | }); |
38 | 38 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | public function upgrade(Request $request) |
12 | 12 | { |
13 | - if (! in_array($request->input('transport'), $this->transports)) { |
|
13 | + if (!in_array($request->input('transport'), $this->transports)) { |
|
14 | 14 | return response()->json([ |
15 | 15 | 'code' => 0, |
16 | 16 | 'message' => 'Transport unknown' |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | { |
103 | 103 | $pid = $this->getPid(); |
104 | 104 | |
105 | - if (! $this->isRunning($pid)) { |
|
105 | + if (!$this->isRunning($pid)) { |
|
106 | 106 | $this->error("Failed! There is no swoole_http_server process running."); |
107 | 107 | exit(1); |
108 | 108 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | { |
145 | 145 | $pid = $this->getPid(); |
146 | 146 | |
147 | - if (! $this->isRunning($pid)) { |
|
147 | + if (!$this->isRunning($pid)) { |
|
148 | 148 | $this->error("Failed! There is no swoole_http_server process running."); |
149 | 149 | exit(1); |
150 | 150 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $isRunning = $this->killProcess($pid, SIGUSR1); |
155 | 155 | |
156 | - if (! $isRunning) { |
|
156 | + if (!$isRunning) { |
|
157 | 157 | $this->error('> failure'); |
158 | 158 | exit(1); |
159 | 159 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | { |
212 | 212 | $this->action = $this->argument('action'); |
213 | 213 | |
214 | - if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'])) { |
|
214 | + if (!in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'])) { |
|
215 | 215 | $this->error("Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'."); |
216 | 216 | exit(1); |
217 | 217 | } |
@@ -225,13 +225,13 @@ discard block |
||
225 | 225 | */ |
226 | 226 | protected function isRunning($pid) |
227 | 227 | { |
228 | - if (! $pid) { |
|
228 | + if (!$pid) { |
|
229 | 229 | return false; |
230 | 230 | } |
231 | 231 | |
232 | 232 | Process::kill($pid, 0); |
233 | 233 | |
234 | - return ! swoole_errno(); |
|
234 | + return !swoole_errno(); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $start = time(); |
251 | 251 | |
252 | 252 | do { |
253 | - if (! $this->isRunning($pid)) { |
|
253 | + if (!$this->isRunning($pid)) { |
|
254 | 254 | break; |
255 | 255 | } |
256 | 256 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | if (file_exists($path)) { |
279 | 279 | $pid = (int) file_get_contents($path); |
280 | 280 | |
281 | - if (! $pid) { |
|
281 | + if (!$pid) { |
|
282 | 282 | $this->removePidFile(); |
283 | 283 | } else { |
284 | 284 | $this->pid = $pid; |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | { |
324 | 324 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
325 | 325 | throw new \RuntimeException("Swoole extension doesn't support Windows OS yet."); |
326 | - } elseif (! extension_loaded('swoole')) { |
|
326 | + } elseif (!extension_loaded('swoole')) { |
|
327 | 327 | throw new \RuntimeException("Can't detect Swoole extension installed."); |
328 | 328 | } |
329 | 329 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $this->checkTable($table); |
92 | 92 | $redisKey = $this->getKey($key, $table); |
93 | 93 | |
94 | - $this->redis->pipeline(function ($pipe) use ($redisKey, $values) { |
|
94 | + $this->redis->pipeline(function($pipe) use ($redisKey, $values) { |
|
95 | 95 | foreach ($values as $value) { |
96 | 96 | $pipe->sadd($redisKey, $value); |
97 | 97 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $this->checkTable($table); |
106 | 106 | $redisKey = $this->getKey($key, $table); |
107 | 107 | |
108 | - $this->redis->pipeline(function ($pipe) use ($redisKey, $values) { |
|
108 | + $this->redis->pipeline(function($pipe) use ($redisKey, $values) { |
|
109 | 109 | foreach ($values as $value) { |
110 | 110 | $pipe->srem($redisKey, $value); |
111 | 111 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function checkTable(string $table) |
128 | 128 | { |
129 | - if (! in_array($table, ['rooms', 'fds'])) { |
|
129 | + if (!in_array($table, ['rooms', 'fds'])) { |
|
130 | 130 | throw new \InvalidArgumentException('invalid table name.'); |
131 | 131 | } |
132 | 132 | } |