Completed
Pull Request — master (#286)
by
unknown
10:33
created
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/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.
src/Server/PidManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@
 block discarded – undo
30 30
      */
31 31
     public function write(int $masterPid, int $managerPid): void
32 32
     {
33
-        if (! is_writable($this->pidFile)
34
-            && ! is_writable(dirname($this->pidFile))
33
+        if (!is_writable($this->pidFile)
34
+            && !is_writable(dirname($this->pidFile))
35 35
         ) {
36 36
             throw new \RuntimeException(
37 37
                 sprintf('Pid file "%s" is not writable', $this->pidFile)
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
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     protected function stop()
135 135
     {
136
-        if (! $this->isRunning()) {
136
+        if (!$this->isRunning()) {
137 137
             $this->error("Failed! There is no swoole_http_server process running.");
138 138
 
139 139
             return;
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      */
174 174
     protected function reload()
175 175
     {
176
-        if (! $this->isRunning()) {
176
+        if (!$this->isRunning()) {
177 177
             $this->error("Failed! There is no swoole_http_server process running.");
178 178
 
179 179
             return;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
         $this->info('Reloading swoole_http_server...');
183 183
 
184
-        if (! $this->killProcess(SIGUSR1)) {
184
+        if (!$this->killProcess(SIGUSR1)) {
185 185
             $this->error('> failure');
186 186
 
187 187
             return;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     {
242 242
         $this->action = $this->argument('action');
243 243
 
244
-        if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) {
244
+        if (!in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) {
245 245
             $this->error(
246 246
                 "Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'."
247 247
             );
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         $filter = Arr::get($this->config, 'hot_reload.filter');
263 263
         $log = Arr::get($this->config, 'hot_reload.log');
264 264
 
265
-        $cb = function (FSEvent $event) use ($server, $log) {
265
+        $cb = function(FSEvent $event) use ($server, $log) {
266 266
             $log ? $this->info(FSOutput::format($event)) : null;
267 267
             $server->reload();
268 268
         };
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     {
282 282
         $pids = $this->laravel->make(PidManager::class)->read();
283 283
 
284
-        if (! count($pids)) {
284
+        if (!count($pids)) {
285 285
             return false;
286 286
         }
287 287
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
             $start = time();
316 316
 
317 317
             do {
318
-                if (! $this->isRunning()) {
318
+                if (!$this->isRunning()) {
319 319
                     break;
320 320
                 }
321 321
 
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
             exit(1);
346 346
         }
347 347
 
348
-        if (! extension_loaded('swoole')) {
348
+        if (!extension_loaded('swoole')) {
349 349
             $this->error('Can\'t detect Swoole extension installed.');
350 350
 
351 351
             exit(1);
352 352
         }
353 353
 
354
-        if (! version_compare(swoole_version(), '4.3.1', 'ge')) {
354
+        if (!version_compare(swoole_version(), '4.3.1', 'ge')) {
355 355
             $this->error('Your Swoole version must be higher than `4.3.1`.');
356 356
 
357 357
             exit(1);
@@ -363,15 +363,15 @@  discard block
 block discarded – undo
363 363
      */
364 364
     protected function registerAccessLog()
365 365
     {
366
-        $this->laravel->singleton(OutputStyle::class, function () {
366
+        $this->laravel->singleton(OutputStyle::class, function() {
367 367
             return new OutputStyle($this->input, $this->output);
368 368
         });
369 369
 
370
-        $this->laravel->singleton(AccessOutput::class, function () {
370
+        $this->laravel->singleton(AccessOutput::class, function() {
371 371
             return new AccessOutput(new ConsoleOutput);
372 372
         });
373 373
 
374
-        $this->laravel->singleton(AccessLog::class, function (Container $container) {
374
+        $this->laravel->singleton(AccessLog::class, function(Container $container) {
375 375
             return new AccessLog($container->make(AccessOutput::class));
376 376
         });
377 377
     }
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
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             // enable sandbox
72 72
             $sandbox->enable();
73 73
             // check if socket.io connection established
74
-            if (! $this->websocketHandler->onOpen($swooleRequest->fd, $illuminateRequest)) {
74
+            if (!$this->websocketHandler->onOpen($swooleRequest->fd, $illuminateRequest)) {
75 75
                 return;
76 76
             }
77 77
             // trigger 'connect' websocket event
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             // enable sandbox
110 110
             $sandbox->enable();
111 111
 
112
-            if (! $this->app->make($handler)->handle($swooleRequest, $response)) {
112
+            if (!$this->app->make($handler)->handle($swooleRequest, $response)) {
113 113
                 return false;
114 114
             }
115 115
             // trigger 'connect' websocket event
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public function onClose($server, $fd, $reactorId)
177 177
     {
178
-        if (! $this->isServerWebsocket($fd) || ! $server instanceof WebsocketServer) {
178
+        if (!$this->isServerWebsocket($fd) || !$server instanceof WebsocketServer) {
179 179
             return;
180 180
         }
181 181
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     protected function isWebsocketPushPacket($packet)
207 207
     {
208
-        if (! is_array($packet)) {
208
+        if (!is_array($packet)) {
209 209
             return false;
210 210
         }
211 211
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     {
294 294
         $handlerClass = $this->container->make('config')->get('swoole_websocket.handler');
295 295
 
296
-        if (! $handlerClass) {
296
+        if (!$handlerClass) {
297 297
             throw new WebsocketNotSetInConfigException;
298 298
         }
299 299
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
      */
355 355
     protected function bindRoom(): void
356 356
     {
357
-        $this->app->singleton(RoomContract::class, function (Container $app) {
357
+        $this->app->singleton(RoomContract::class, function(Container $app) {
358 358
             return $this->websocketRoom;
359 359
         });
360 360
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
      */
367 367
     protected function bindWebsocket()
368 368
     {
369
-        $this->app->singleton(Websocket::class, function (Container $app) {
369
+        $this->app->singleton(Websocket::class, function(Container $app) {
370 370
             return new Websocket($app->make(RoomContract::class), new Pipeline($app));
371 371
         });
372 372
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         $routePath = $this->container->make('config')
382 382
             ->get('swoole_websocket.route_file');
383 383
 
384
-        if (! file_exists($routePath)) {
384
+        if (!file_exists($routePath)) {
385 385
             $routePath = __DIR__ . '/../../routes/websocket.php';
386 386
         }
387 387
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
      */
398 398
     public function isWebsocketPushPayload($payload): bool
399 399
     {
400
-        if (! is_array($payload)) {
400
+        if (!is_array($payload)) {
401 401
             return false;
402 402
         }
403 403
 
Please login to merge, or discard this patch.