@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getApplication() |
110 | 110 | { |
111 | - if (! $this->application instanceof Container) { |
|
111 | + if (!$this->application instanceof Container) { |
|
112 | 112 | $this->application = $this->loadApplication(); |
113 | 113 | } |
114 | 114 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function getKernel() |
122 | 122 | { |
123 | - if (! $this->kernel instanceof Kernel) { |
|
123 | + if (!$this->kernel instanceof Kernel) { |
|
124 | 124 | $this->kernel = $this->getApplication()->make(Kernel::class); |
125 | 125 | } |
126 | 126 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | $framework = strtolower($framework); |
242 | 242 | |
243 | - if (! in_array($framework, ['laravel', 'lumen'])) { |
|
243 | + if (!in_array($framework, ['laravel', 'lumen'])) { |
|
244 | 244 | throw new \Exception(sprintf('Not support framework "%s".', $this->framework)); |
245 | 245 | } |
246 | 246 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | { |
322 | 322 | $application = $this->application; |
323 | 323 | |
324 | - $closure = function () use ($application) { |
|
324 | + $closure = function() use ($application) { |
|
325 | 325 | $this->app = $application; |
326 | 326 | }; |
327 | 327 |
@@ -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 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $config = $this->container['config']->get('swoole_http.server.options'); |
156 | 156 | |
157 | 157 | // only enable task worker in websocket mode |
158 | - if (! $this->isWebsocket) { |
|
158 | + if (!$this->isWebsocket) { |
|
159 | 159 | unset($config['task_worker_num']); |
160 | 160 | } |
161 | 161 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | if (method_exists($this, $listener)) { |
174 | 174 | $this->server->on($event, [$this, $listener]); |
175 | 175 | } else { |
176 | - $this->server->on($event, function () use ($event) { |
|
176 | + $this->server->on($event, function() use ($event) { |
|
177 | 177 | $event = sprintf('swoole.%s', $event); |
178 | 178 | |
179 | 179 | $this->container['events']->fire($event, func_get_args()); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $publicPath = $this->container['config']->get('swoole_http.server.public_path', base_path('public')); |
296 | 296 | $filename = $publicPath . $uri; |
297 | 297 | |
298 | - if (! is_file($filename) || filesize($filename) === 0) { |
|
298 | + if (!is_file($filename) || filesize($filename) === 0) { |
|
299 | 299 | return; |
300 | 300 | } |
301 | 301 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | */ |
374 | 374 | protected function getApplication() |
375 | 375 | { |
376 | - if (! $this->application instanceof Application) { |
|
376 | + if (!$this->application instanceof Application) { |
|
377 | 377 | $this->createApplication(); |
378 | 378 | } |
379 | 379 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | */ |
416 | 416 | protected function bindSwooleServer() |
417 | 417 | { |
418 | - $this->app->singleton('swoole.server', function () { |
|
418 | + $this->app->singleton('swoole.server', function() { |
|
419 | 419 | return $this->server; |
420 | 420 | }); |
421 | 421 | } |
@@ -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 | } |