@@ -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; |
@@ -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 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | protected function rebindProviderContainer($provider, $application) |
| 182 | 182 | { |
| 183 | - $closure = function () use ($application) { |
|
| 183 | + $closure = function() use ($application) { |
|
| 184 | 184 | $this->app = $application; |
| 185 | 185 | }; |
| 186 | 186 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | if ($this->isFramework('laravel')) { |
| 229 | 229 | $router = $application->make('router'); |
| 230 | 230 | $request = $this->request; |
| 231 | - $closure = function () use ($application, $request) { |
|
| 231 | + $closure = function() use ($application, $request) { |
|
| 232 | 232 | $this->container = $application; |
| 233 | 233 | if (is_null($request)) { |
| 234 | 234 | return; |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | { |
| 260 | 260 | $view = $application->make('view'); |
| 261 | 261 | |
| 262 | - $closure = function () use ($application) { |
|
| 262 | + $closure = function() use ($application) { |
|
| 263 | 263 | $this->container = $application; |
| 264 | 264 | $this->shared['app'] = $application; |
| 265 | 265 | }; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | public function disable() |
| 310 | 310 | { |
| 311 | - if (! $this->enabled) { |
|
| 311 | + if (!$this->enabled) { |
|
| 312 | 312 | return; |
| 313 | 313 | } |
| 314 | 314 | |
@@ -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 | } |