Completed
Pull Request — master (#60)
by Kun
06:38
created
src/Base.php 2 patches
Unused Use Statements   -5 removed lines patch added patch discarded remove patch
@@ -2,17 +2,12 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
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
         };
Please login to merge, or discard this patch.
src/Commands/LaravooleCommand.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -3,9 +3,7 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/LaravooleBoardcaster.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Wrapper/Swoole.php 2 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -1,10 +1,7 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Wrapper/SwooleHttpWrapper.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,6 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Wrapper/SwooleWebSocketWrapper.php 1 patch
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -4,15 +4,11 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Wrapper/Workerman.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
config/laravoole.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
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')) {
Please login to merge, or discard this patch.
src/Middleware/Auth.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.