Passed
Push — master ( 5ba982...768465 )
by Albert
09:06 queued 06:37
created
src/Concerns/InteractsWithWebsocket.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             // enable sandbox
67 67
             $sandbox->enable();
68 68
             // check if socket.io connection established
69
-            if (! $this->websocketHandler->onOpen($swooleRequest->fd, $illuminateRequest)) {
69
+            if (!$this->websocketHandler->onOpen($swooleRequest->fd, $illuminateRequest)) {
70 70
                 return;
71 71
             }
72 72
             // trigger 'connect' websocket event
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function onClose($server, $fd, $reactorId)
132 132
     {
133
-        if (! $this->isServerWebsocket($fd) || ! $server instanceof WebsocketServer) {
133
+        if (!$this->isServerWebsocket($fd) || !$server instanceof WebsocketServer) {
134 134
             return;
135 135
         }
136 136
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     protected function isWebsocketPushPacket($packet)
160 160
     {
161
-        if (! is_array($packet)) {
161
+        if (!is_array($packet)) {
162 162
             return false;
163 163
         }
164 164
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     {
244 244
         $handlerClass = $this->container->make('config')->get('swoole_websocket.handler');
245 245
 
246
-        if (! $handlerClass) {
246
+        if (!$handlerClass) {
247 247
             throw new WebsocketNotSetInConfigException;
248 248
         }
249 249
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      */
291 291
     protected function bindRoom(): void
292 292
     {
293
-        $this->app->singleton(RoomContract::class, function (Container $container) {
293
+        $this->app->singleton(RoomContract::class, function(Container $container) {
294 294
             $config = $container->make('config');
295 295
             $driver = $config->get('swoole_websocket.default');
296 296
             $settings = $config->get("swoole_websocket.settings.{$driver}");
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      */
312 312
     protected function bindWebsocket()
313 313
     {
314
-        $this->app->singleton(Websocket::class, function (Container $app) {
314
+        $this->app->singleton(Websocket::class, function(Container $app) {
315 315
             return new Websocket($app->make(RoomContract::class), new Pipeline($app));
316 316
         });
317 317
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         $routePath = $this->container->make('config')
327 327
             ->get('swoole_websocket.route_file');
328 328
 
329
-        if (! file_exists($routePath)) {
329
+        if (!file_exists($routePath)) {
330 330
             $routePath = __DIR__ . '/../../routes/websocket.php';
331 331
         }
332 332
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
      */
343 343
     public function isWebsocketPushPayload($payload): bool
344 344
     {
345
-        if (! is_array($payload)) {
345
+        if (!is_array($payload)) {
346 346
             return false;
347 347
         }
348 348
 
Please login to merge, or discard this patch.
src/HttpServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $options = $config->get('swoole_http.server.options');
150 150
 
151 151
         // only enable task worker in websocket mode and for queue driver
152
-        if ($config->get('queue.default') !== 'swoole' && ! $this->isWebsocket) {
152
+        if ($config->get('queue.default') !== 'swoole' && !$this->isWebsocket) {
153 153
             unset($options['task_worker_num']);
154 154
         }
155 155
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      */
164 164
     protected function registerServer()
165 165
     {
166
-        $this->app->singleton(Server::class, function () {
166
+        $this->app->singleton(Server::class, function() {
167 167
             if (is_null(static::$server)) {
168 168
                 $this->createSwooleServer();
169 169
                 $this->configureSwooleServer();
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
      */
180 180
     protected function registerDatabaseDriver()
181 181
     {
182
-        $this->app->extend(DatabaseManager::class, function (DatabaseManager $db) {
183
-            $db->extend('mysql-coroutine', function ($config, $name) {
182
+        $this->app->extend(DatabaseManager::class, function(DatabaseManager $db) {
183
+            $db->extend('mysql-coroutine', function($config, $name) {
184 184
                 $config['name'] = $name;
185 185
 
186 186
                 $connection = new MySqlConnection(
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
      */
224 224
     protected function registerSwooleQueueDriver()
225 225
     {
226
-        $this->app->afterResolving('queue', function (QueueManager $manager) {
227
-            $manager->addConnector('swoole', function () {
226
+        $this->app->afterResolving('queue', function(QueueManager $manager) {
227
+            $manager->addConnector('swoole', function() {
228 228
                 return new SwooleTaskConnector($this->app->make(Server::class));
229 229
             });
230 230
         });
Please login to merge, or discard this patch.
src/Helpers/Dumper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
     public static function dump(...$args)
14 14
     {
15
-        if (! static::$cloner instanceOf VarCloner) {
15
+        if (!static::$cloner instanceOf VarCloner) {
16 16
             static::$cloner = new VarCloner;
17 17
         }
18 18
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     public static function getDumper()
31 31
     {
32
-        $dumper = defined('IN_PHPUNIT') || ! config('swoole_http.ob_output')
32
+        $dumper = defined('IN_PHPUNIT') || !config('swoole_http.ob_output')
33 33
             ? CliDumper::class
34 34
             : HtmlDumper::class;
35 35
 
Please login to merge, or discard this patch.
src/Commands/HttpServerCommand.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $pid = $this->getCurrentPid();
136 136
 
137
-        if (! $this->isRunning($pid)) {
137
+        if (!$this->isRunning($pid)) {
138 138
             $this->error("Failed! There is no swoole_http_server process running.");
139 139
 
140 140
             return;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     {
179 179
         $pid = $this->getCurrentPid();
180 180
 
181
-        if (! $this->isRunning($pid)) {
181
+        if (!$this->isRunning($pid)) {
182 182
             $this->error("Failed! There is no swoole_http_server process running.");
183 183
 
184 184
             return;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
         $isRunning = $this->killProcess($pid, SIGUSR1);
190 190
 
191
-        if (! $isRunning) {
191
+        if (!$isRunning) {
192 192
             $this->error('> failure');
193 193
 
194 194
             return;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         $this->action = $this->argument('action');
247 247
 
248
-        if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) {
248
+        if (!in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) {
249 249
             $this->error(
250 250
                 "Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'."
251 251
             );
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         $filter = Arr::get($this->config, 'hot_reload.filter');
267 267
         $log = Arr::get($this->config, 'hot_reload.log');
268 268
 
269
-        $cb = function (FSEvent $event) use ($server, $log) {
269
+        $cb = function(FSEvent $event) use ($server, $log) {
270 270
             $log ? $this->info(FSOutput::format($event)) : null;
271 271
             $server->reload();
272 272
         };
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      */
284 284
     protected function isRunning($pid)
285 285
     {
286
-        if (! $pid) {
286
+        if (!$pid) {
287 287
             return false;
288 288
         }
289 289
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             $start = time();
312 312
 
313 313
             do {
314
-                if (! $this->isRunning($pid)) {
314
+                if (!$this->isRunning($pid)) {
315 315
                     break;
316 316
                 }
317 317
 
@@ -379,13 +379,13 @@  discard block
 block discarded – undo
379 379
             exit(1);
380 380
         }
381 381
 
382
-        if (! extension_loaded('swoole')) {
382
+        if (!extension_loaded('swoole')) {
383 383
             $this->error('Can\'t detect Swoole extension installed.');
384 384
 
385 385
             exit(1);
386 386
         }
387 387
 
388
-        if (! version_compare(swoole_version(), '4.3.1', 'ge')) {
388
+        if (!version_compare(swoole_version(), '4.3.1', 'ge')) {
389 389
             $this->error('Your Swoole version must be higher than `4.3.1`.');
390 390
 
391 391
             exit(1);
@@ -397,15 +397,15 @@  discard block
 block discarded – undo
397 397
      */
398 398
     protected function registerAccessLog()
399 399
     {
400
-        $this->laravel->singleton(OutputStyle::class, function () {
400
+        $this->laravel->singleton(OutputStyle::class, function() {
401 401
             return new OutputStyle($this->input, $this->output);
402 402
         });
403 403
 
404
-        $this->laravel->singleton(AccessOutput::class, function () {
404
+        $this->laravel->singleton(AccessOutput::class, function() {
405 405
             return new AccessOutput(new ConsoleOutput);
406 406
         });
407 407
 
408
-        $this->laravel->singleton(AccessLog::class, function (Container $container) {
408
+        $this->laravel->singleton(AccessLog::class, function(Container $container) {
409 409
             return new AccessLog($container->make(AccessOutput::class));
410 410
         });
411 411
     }
Please login to merge, or discard this patch.
src/LumenServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      */
18 18
     protected function registerManager()
19 19
     {
20
-        $this->app->singleton(Manager::class, function ($app) {
20
+        $this->app->singleton(Manager::class, function($app) {
21 21
             return new Manager($app, 'lumen');
22 22
         });
23 23
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     protected function bootWebsocketRoutes()
33 33
     {
34 34
         $this->app->router
35
-            ->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($router) {
35
+            ->group(['namespace' => 'SwooleTW\Http\Controllers'], function($router) {
36 36
                 require __DIR__ . '/../routes/lumen_routes.php';
37 37
             });
38 38
     }
Please login to merge, or discard this patch.
src/Websocket/Pusher.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function shouldBroadcast(): bool
211 211
     {
212
-        return $this->broadcast && empty($this->descriptors) && ! $this->assigned;
212
+        return $this->broadcast && empty($this->descriptors) && !$this->assigned;
213 213
     }
214 214
 
215 215
     /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      */
222 222
     protected function getWebsocketConnections(): array
223 223
     {
224
-        return array_filter(iterator_to_array($this->server->connections), function ($fd) {
224
+        return array_filter(iterator_to_array($this->server->connections), function($fd) {
225 225
             return $this->server->isEstablished($fd);
226 226
         });
227 227
     }
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      */
234 234
     public function shouldPushToDescriptor(int $fd): bool
235 235
     {
236
-        if (! $this->server->isEstablished($fd)) {
236
+        if (!$this->server->isEstablished($fd)) {
237 237
             return false;
238 238
         }
239 239
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     public function push($payload): void
251 251
     {
252 252
         // attach sender if not broadcast
253
-        if (! $this->broadcast && $this->sender && ! $this->hasDescriptor($this->sender)) {
253
+        if (!$this->broadcast && $this->sender && !$this->hasDescriptor($this->sender)) {
254 254
             $this->addDescriptor($this->sender);
255 255
         }
256 256
 
Please login to merge, or discard this patch.