@@ -24,7 +24,7 @@ |
||
| 24 | 24 | // SwooleFastCGI uses swoole to response fastcgi requests (just like php-fpm) |
| 25 | 25 | // SwooleWebSocket uses swoole to response websocket requests and http requests |
| 26 | 26 | // WorkermanFastCGI uses workerman to response fastcgi requests (just like php-fpm) |
| 27 | - 'mode' => env('LARAVOOLE_MODE', function () { |
|
| 27 | + 'mode' => env('LARAVOOLE_MODE', function() { |
|
| 28 | 28 | if (extension_loaded('swoole')) { |
| 29 | 29 | return 'SwooleHttp'; |
| 30 | 30 | } elseif (class_exists('Workerman\Worker')) { |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | if (!$request->hasMacro('laravooleUserResolver')) { |
| 12 | 12 | return response('Unauthorized.', 401); |
| 13 | 13 | } |
| 14 | - $request->setUserResolver(function () use ($request) { |
|
| 14 | + $request->setUserResolver(function() use ($request) { |
|
| 15 | 15 | return $request->laravooleUserResolver(); |
| 16 | 16 | }); |
| 17 | 17 | return $next($request); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | exit; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if(!class_exists($wrapper = "Laravoole\\Wrapper\\{$mode}Wrapper")) { |
|
| 107 | + if (!class_exists($wrapper = "Laravoole\\Wrapper\\{$mode}Wrapper")) { |
|
| 108 | 108 | $wrapper = $mode; |
| 109 | 109 | } |
| 110 | 110 | $ref = new ReflectionClass($wrapper); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $default = null; |
| 119 | 119 | } |
| 120 | 120 | $key = $paramName; |
| 121 | - $value = config("laravoole.handler_config.{$key}", function () use ($key, $default) { |
|
| 121 | + $value = config("laravoole.handler_config.{$key}", function() use ($key, $default) { |
|
| 122 | 122 | return env("LARAVOOLE_" . strtoupper($key), $default); |
| 123 | 123 | }); |
| 124 | 124 | if ($value !== null) { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $host = config('laravoole.base_config.host'); |
| 134 | 134 | $port = config('laravoole.base_config.port'); |
| 135 | 135 | $socket = @stream_socket_server("tcp://{$host}:{$port}"); |
| 136 | - if(!$socket) { |
|
| 136 | + if (!$socket) { |
|
| 137 | 137 | throw new \Exception("Address {$host}:{$port} already in use", 1); |
| 138 | 138 | } else { |
| 139 | 139 | fclose($socket); |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | public function auth($request) |
| 21 | 21 | { |
| 22 | 22 | if (Str::startsWith($request->channel_name, ['private-', 'presence-']) && |
| 23 | - ! $request->user()) { |
|
| 23 | + !$request->user()) { |
|
| 24 | 24 | throw new HttpException(403); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | require $wrapper_file; |
| 19 | 19 | } |
| 20 | 20 | $ref = new ReflectionClass($wrapper); |
| 21 | - if(!$ref->implementsInterface(ServerInterface::class)) { |
|
| 21 | + if (!$ref->implementsInterface(ServerInterface::class)) { |
|
| 22 | 22 | throw new Exception("$wrapper must be instance of Laravoole\\Wrapper\\ServerInterface", 1); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public static function decode($data) |
| 18 | 18 | { |
| 19 | 19 | $data = @json_decode($data); |
| 20 | - if(!isset($data->m) || !isset($data->p)) { |
|
| 20 | + if (!isset($data->m) || !isset($data->p)) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | return [ |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | { |
| 7 | 7 | public static function encode($statusCode, $method, $content, $echo) |
| 8 | 8 | { |
| 9 | - if($statusCode >= 400) { |
|
| 9 | + if ($statusCode >= 400) { |
|
| 10 | 10 | $error = $content; |
| 11 | 11 | $content = null; |
| 12 | 12 | } else { |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | public static function decode($data) |
| 25 | 25 | { |
| 26 | 26 | $data = @json_decode($data); |
| 27 | - if(!isset($data->method) || !isset($data->params)) { |
|
| 27 | + if (!isset($data->method) || !isset($data->params)) { |
|
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | 30 | return [ |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | { |
| 86 | 86 | parent::prepareKernel(); |
| 87 | 87 | $server = $this->server; |
| 88 | - $this->app->singleton('laravoole.server', function ($app) use ($server) { |
|
| 88 | + $this->app->singleton('laravoole.server', function($app) use ($server) { |
|
| 89 | 89 | return $server; |
| 90 | 90 | }); |
| 91 | 91 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | } |
| 36 | 36 | // content |
| 37 | 37 | if ($illuminateResponse instanceof BinaryFileResponse) { |
| 38 | - $content = function () use ($illuminateResponse) { |
|
| 38 | + $content = function() use ($illuminateResponse) { |
|
| 39 | 39 | return $illuminateResponse->getFile()->getPathname(); |
| 40 | 40 | }; |
| 41 | 41 | if ($accept_gzip && isset($response->header['Content-Type'])) { |