Passed
Branch feature/coroutine_feature (16a200)
by Albert
02:06
created
routes/websocket.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@
 block discarded – undo
12 12
 |
13 13
 */
14 14
 
15
-Websocket::on('connect', function ($websocket, Request $request) {
15
+Websocket::on('connect', function($websocket, Request $request) {
16 16
     // called while socket on connect
17 17
 });
18 18
 
19
-Websocket::on('disconnect', function ($websocket) {
19
+Websocket::on('disconnect', function($websocket) {
20 20
     // called while socket on disconnect
21 21
 });
22 22
 
23
-Websocket::on('example', function ($websocket, $data) {
23
+Websocket::on('example', function($websocket, $data) {
24 24
     $websocket->emit('message', $data);
25 25
 });
26 26
 
Please login to merge, or discard this patch.
routes/laravel_routes.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
 |
12 12
 */
13 13
 
14
-Route::group(['namespace' => 'SwooleTW\Http\Controllers'], function () {
14
+Route::group(['namespace' => 'SwooleTW\Http\Controllers'], function() {
15 15
     Route::get('socket.io', 'SocketIOController@upgrade');
16 16
     Route::post('socket.io', 'SocketIOController@reject');
17 17
 });
Please login to merge, or discard this patch.
src/Concerns/WithApplication.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function getApplication()
63 63
     {
64
-        if (! $this->app instanceof Container) {
64
+        if (!$this->app instanceof Container) {
65 65
             $this->app = $this->loadApplication();
66 66
             $this->bootstrap();
67 67
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
         $framework = strtolower($framework);
110 110
 
111
-        if (! in_array($framework, ['laravel', 'lumen'])) {
111
+        if (!in_array($framework, ['laravel', 'lumen'])) {
112 112
             throw new \Exception(sprintf('Not support framework "%s".', $framework));
113 113
         }
114 114
 
Please login to merge, or discard this patch.
src/Concerns/InteractsWithWebsocket.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             // enable sandbox
55 55
             $this->app['swoole.sandbox']->enable();
56 56
             // check if socket.io connection established
57
-            if (! $this->websocketHandler->onOpen($swooleRequest->fd, $illuminateRequest)) {
57
+            if (!$this->websocketHandler->onOpen($swooleRequest->fd, $illuminateRequest)) {
58 58
                 return;
59 59
             }
60 60
             // trigger 'connect' websocket event
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function onClose($server, $fd, $reactorId)
118 118
     {
119
-        if (! $this->isWebsocket($fd)) {
119
+        if (!$this->isWebsocket($fd)) {
120 120
             return;
121 121
         }
122 122
 
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
         $message = $this->parser->encode($event, $message);
148 148
 
149 149
         // attach sender if not broadcast
150
-        if (! $broadcast && $sender && ! in_array($sender, $fds)) {
150
+        if (!$broadcast && $sender && !in_array($sender, $fds)) {
151 151
             $fds[] = $sender;
152 152
         }
153 153
 
154 154
         // check if to broadcast all clients
155
-        if ($broadcast && empty($fds) && ! $assigned) {
155
+        if ($broadcast && empty($fds) && !$assigned) {
156 156
             foreach ($server->connections as $fd) {
157 157
                 if ($this->isWebsocket($fd)) {
158 158
                     $fds[] = $fd;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
         // push message to designated fds
164 164
         foreach ($fds as $fd) {
165
-            if (($broadcast && $sender === (integer) $fd) || ! $server->exist($fd)) {
165
+            if (($broadcast && $sender === (integer) $fd) || !$server->exist($fd)) {
166 166
                 continue;
167 167
             }
168 168
             $server->push($fd, $message, $opcode);
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     {
222 222
         $handlerClass = $this->container['config']->get('swoole_websocket.handler');
223 223
 
224
-        if (! $handlerClass) {
224
+        if (!$handlerClass) {
225 225
             throw new Exception('Websocket handler is not set in swoole_websocket config');
226 226
         }
227 227
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      */
267 267
     protected function bindRoom()
268 268
     {
269
-        $this->app->singleton(RoomContract::class, function ($app) {
269
+        $this->app->singleton(RoomContract::class, function($app) {
270 270
             return $this->getWebsocketRoom();
271 271
         });
272 272
         $this->app->alias(RoomContract::class, 'swoole.room');
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      */
278 278
     protected function bindWebsocket()
279 279
     {
280
-        $this->app->singleton(Websocket::class, function ($app) {
280
+        $this->app->singleton(Websocket::class, function($app) {
281 281
             return new Websocket($app['swoole.room'], new Pipeline($app));
282 282
         });
283 283
         $this->app->alias(Websocket::class, 'swoole.websocket');
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     {
291 291
         $routePath = $this->container['config']->get('swoole_websocket.route_file');
292 292
 
293
-        if (! file_exists($routePath)) {
293
+        if (!file_exists($routePath)) {
294 294
             $routePath = __DIR__ . '/../../routes/websocket.php';
295 295
         }
296 296
 
Please login to merge, or discard this patch.
src/Concerns/InteractsWithSwooleTable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     protected function bindSwooleTable()
51 51
     {
52
-        $this->app->singleton(SwooleTable::class, function () {
52
+        $this->app->singleton(SwooleTable::class, function() {
53 53
             return $this->table;
54 54
         });
55 55
         $this->app->alias(SwooleTable::class, 'swoole.table');
Please login to merge, or discard this patch.
src/Server/Manager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             if (method_exists($this, $listener)) {
102 102
                 $this->container['swoole.server']->on($event, [$this, $listener]);
103 103
             } else {
104
-                $this->container['swoole.server']->on($event, function () use ($event) {
104
+                $this->container['swoole.server']->on($event, function() use ($event) {
105 105
                     $event = sprintf('swoole.%s', $event);
106 106
 
107 107
                     $this->container['events']->fire($event, func_get_args());
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      */
275 275
     protected function bindSwooleServer()
276 276
     {
277
-        $this->app->singleton(Server::class, function ($app) {
277
+        $this->app->singleton(Server::class, function($app) {
278 278
             return $this->container['swoole.server'];
279 279
         });
280 280
         $this->app->alias(Server::class, 'swoole.server');
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     protected function bindSandbox()
287 287
     {
288
-        $this->app->singleton(Sandbox::class, function ($app) {
288
+        $this->app->singleton(Sandbox::class, function($app) {
289 289
             return new Sandbox($app, $this->framework);
290 290
         });
291 291
         $this->app->alias(Sandbox::class, 'swoole.sandbox');
Please login to merge, or discard this patch.
src/Server/Sandbox.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function __construct($app = null, $framework = null)
44 44
     {
45
-        if (! $app instanceof Container) {
45
+        if (!$app instanceof Container) {
46 46
             return;
47 47
         }
48 48
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function initialize()
104 104
     {
105
-        if (! $this->app instanceof Container) {
105
+        if (!$this->app instanceof Container) {
106 106
             throw new SandboxException('A base app has not been set.');
107 107
         }
108 108
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     public function run(Request $request)
212 212
     {
213
-        if (! $this->getSnapshot() instanceof Container) {
213
+        if (!$this->getSnapshot() instanceof Container) {
214 214
             throw new SandboxException('Sandbox is not enabled.');
215 215
         }
216 216
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             $response->sendContent();
261 261
         } elseif ($response instanceof SymfonyResponse) {
262 262
             $content = $response->getContent();
263
-        } elseif (! $isFile = $response instanceof BinaryFileResponse) {
263
+        } elseif (!$isFile = $response instanceof BinaryFileResponse) {
264 264
             $content = (string) $response;
265 265
         }
266 266
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         $this->terminate($request, $response);
269 269
 
270 270
         // append ob content to response
271
-        if (! $isFile && ob_get_length() > 0) {
271
+        if (!$isFile && ob_get_length() > 0) {
272 272
             if ($isStream) {
273 273
                 $response->output = ob_get_contents();
274 274
             } else {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      */
342 342
     public function enable()
343 343
     {
344
-        if (! $this->config instanceof ConfigContract) {
344
+        if (!$this->config instanceof ConfigContract) {
345 345
             throw new SandboxException('Please initialize after setting base app.');
346 346
         }
347 347
 
Please login to merge, or discard this patch.
src/LaravelServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     protected function registerManager()
15 15
     {
16
-        $this->app->singleton('swoole.manager', function ($app) {
16
+        $this->app->singleton('swoole.manager', function($app) {
17 17
             return new Manager($app, 'laravel');
18 18
         });
19 19
     }
@@ -25,6 +25,6 @@  discard block
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Coroutine/PDOStatement.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function bindParam($parameter, &$variable, $type = null, $maxlen = null, $driverdata = null)
50 50
     {
51
-        if (! is_string($parameter) && ! is_int($parameter)) {
51
+        if (!is_string($parameter) && !is_int($parameter)) {
52 52
             return false;
53 53
         }
54 54
 
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 
61 61
     public function bindValue($parameter, $variable, $type = null)
62 62
     {
63
-        if (! is_string($parameter) && ! is_int($parameter)) {
63
+        if (!is_string($parameter) && !is_int($parameter)) {
64 64
             return false;
65 65
         }
66 66
 
67 67
         if (is_object($variable)) {
68
-            if (! method_exists($variable, '__toString')) {
68
+            if (!method_exists($variable, '__toString')) {
69 69
                 return false;
70 70
             } else {
71 71
                 $variable = (string) $variable;
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 
87 87
     public function execute($inputParameters = null)
88 88
     {
89
-        if (! empty($inputParameters)) {
89
+        if (!empty($inputParameters)) {
90 90
             foreach ($inputParameters as $key => $value) {
91 91
                 $this->bindParam($key, $value);
92 92
             }
93 93
         }
94 94
 
95 95
         $inputParameters = [];
96
-        if (! empty($this->statement->bindKeyMap)) {
96
+        if (!empty($this->statement->bindKeyMap)) {
97 97
             foreach ($this->statement->bindKeyMap as $nameKey => $numKey) {
98 98
                 $inputParameters[$numKey] = $this->bindMap[$nameKey];
99 99
             }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         $fetchArgument = null,
144 144
         $ctorArgs = null
145 145
     ) {
146
-        if (! is_array($rawData)) {
146
+        if (!is_array($rawData)) {
147 147
             return false;
148 148
         }
149 149
         if (empty($rawData)) {
Please login to merge, or discard this patch.