| @@ -2,17 +2,12 @@ | ||
| 2 | 2 | namespace Laravoole; | 
| 3 | 3 | |
| 4 | 4 | use Exception; | 
| 5 | -use ErrorException; | |
| 6 | - | |
| 7 | 5 | use swoole_http_request; | 
| 8 | - | |
| 9 | 6 | use Laravoole\Illuminate\Application; | 
| 10 | 7 | use Laravoole\Illuminate\Request as IlluminateRequest; | 
| 11 | - | |
| 12 | 8 | use Illuminate\Support\Facades\Facade; | 
| 13 | 9 | use Illuminate\Contracts\Cookie\QueueingFactory as CookieJar; | 
| 14 | 10 | use Psr\Http\Message\ServerRequestInterface; | 
| 15 | - | |
| 16 | 11 | use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory; | 
| 17 | 12 | use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory; | 
| 18 | 13 | |
| @@ -87,7 +87,7 @@ | ||
| 87 | 87 | } | 
| 88 | 88 | |
| 89 | 89 | $this->kernel = $this->app->make(\Illuminate\Contracts\Http\Kernel::class); | 
| 90 | -        $virus = function () { | |
| 90 | +        $virus = function() { | |
| 91 | 91 | // Insert bofore BootProviders | 
| 92 | 92 | array_splice($this->bootstrappers, -1, 0, [\Illuminate\Foundation\Bootstrap\SetRequestForConsole::class]); | 
| 93 | 93 | }; | 
| @@ -75,6 +75,9 @@ | ||
| 75 | 75 | } | 
| 76 | 76 | } | 
| 77 | 77 | |
| 78 | + /** | |
| 79 | + * @param integer $sig | |
| 80 | + */ | |
| 78 | 81 | protected function sendSignal($sig) | 
| 79 | 82 |      { | 
| 80 | 83 |          if ($pid = $this->getPid()) { | 
| @@ -3,9 +3,7 @@ | ||
| 3 | 3 | namespace Laravoole\Commands; | 
| 4 | 4 | |
| 5 | 5 | use ReflectionClass; | 
| 6 | - | |
| 7 | 6 | use Illuminate\Console\Command; | 
| 8 | -use Symfony\Component\Console\Input\InputOption; | |
| 9 | 7 | |
| 10 | 8 | class LaravooleCommand extends Command | 
| 11 | 9 |  { | 
| @@ -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); | 
| @@ -34,7 +34,7 @@ | ||
| 34 | 34 | * | 
| 35 | 35 | * @param \Illuminate\Http\Request $request | 
| 36 | 36 | * @param mixed $result | 
| 37 | - * @return mixed | |
| 37 | + * @return string | |
| 38 | 38 | */ | 
| 39 | 39 | public function validAuthenticationResponse($request, $result) | 
| 40 | 40 |      { | 
| @@ -6,7 +6,6 @@ | ||
| 6 | 6 | use Illuminate\Support\Str; | 
| 7 | 7 | use Symfony\Component\HttpKernel\Exception\HttpException; | 
| 8 | 8 | use Illuminate\Broadcasting\Broadcasters\Broadcaster; | 
| 9 | - | |
| 10 | 9 | use Laravoole\LaravooleFacade; | 
| 11 | 10 | |
| 12 | 11 | class LaravooleBroadcaster extends Broadcaster | 
| @@ -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 | |
| @@ -100,7 +100,7 @@ | ||
| 100 | 100 | |
| 101 | 101 | /** | 
| 102 | 102 | * 设置Http头信息 | 
| 103 | - * @param $key | |
| 103 | + * @param string $key | |
| 104 | 104 | * @param $value | 
| 105 | 105 | */ | 
| 106 | 106 | public function header($key, $value) | 
| @@ -204,7 +204,7 @@ | ||
| 204 | 204 | |
| 205 | 205 | public function getRawContent($content = '') | 
| 206 | 206 |      { | 
| 207 | -        if($content) { | |
| 207 | +        if ($content) { | |
| 208 | 208 | $this->content = $content; | 
| 209 | 209 |          } else { | 
| 210 | 210 | $content = $this->content; | 
| @@ -1,10 +1,7 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | namespace Laravoole\Wrapper; | 
| 3 | 3 | |
| 4 | -use swoole_http_server; | |
| 5 | - | |
| 6 | 4 | use Laravoole\Base; | 
| 7 | -use Exception; | |
| 8 | 5 | |
| 9 | 6 | abstract class Swoole extends Base | 
| 10 | 7 |  { | 
| @@ -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 | } | 
| @@ -3,8 +3,6 @@ | ||
| 3 | 3 | |
| 4 | 4 | use swoole_http_server; | 
| 5 | 5 | |
| 6 | -use Symfony\Component\HttpFoundation\BinaryFileResponse; | |
| 7 | - | |
| 8 | 6 | class SwooleHttpWrapper extends Swoole implements ServerInterface | 
| 9 | 7 |  { | 
| 10 | 8 | use HttpTrait; | 
| @@ -4,15 +4,11 @@ | ||
| 4 | 4 | use swoole_websocket_server; | 
| 5 | 5 | use swoole_http_request; | 
| 6 | 6 | use swoole_http_response; | 
| 7 | -use swoole_process; | |
| 8 | - | |
| 9 | 7 | use Laravoole\Request; | 
| 10 | 8 | use Laravoole\Response; | 
| 11 | 9 | use Laravoole\WebsocketCodec\Json; | 
| 12 | 10 | use Laravoole\WebsocketCodec\JsonRpc; | 
| 13 | 11 | |
| 14 | -use Symfony\Component\HttpFoundation\BinaryFileResponse; | |
| 15 | - | |
| 16 | 12 | class SwooleWebSocketWrapper extends SwooleHttpWrapper implements ServerInterface | 
| 17 | 13 |  { | 
| 18 | 14 | protected $defaultProtocol; | 
| @@ -3,7 +3,6 @@ | ||
| 3 | 3 | |
| 4 | 4 | use Laravoole\Base; | 
| 5 | 5 | use Exception; | 
| 6 | -use Workerman\Worker; | |
| 7 | 6 | |
| 8 | 7 | abstract class Workerman extends Base implements ServerInterface | 
| 9 | 8 |  { | 
| @@ -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')) { |