Passed
Push — master ( 1628c2...f75d9a )
by Biao
04:29
created
src/Swoole/Timer/CheckGlobalTimerAliveCronJob.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
     public function interval()
13 13
     {
14
-        return (int)(static::GLOBAL_TIMER_LOCK_SECONDS * 0.9) * 1000;
14
+        return (int) (static::GLOBAL_TIMER_LOCK_SECONDS * 0.9) * 1000;
15 15
     }
16 16
 
17 17
     public function isImmediate()
Please login to merge, or discard this patch.
src/LaravelS.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
         parent::bindWebSocketEvents();
77 77
 
78 78
         if ($this->enableWebSocket) {
79
-            $this->swoole->on('Open', function (WebSocketServer $server, SwooleRequest $request) {
79
+            $this->swoole->on('Open', function(WebSocketServer $server, SwooleRequest $request) {
80 80
                 // Start Laravel's lifetime, then support session ...middleware.
81 81
                 $laravelRequest = $this->convertRequest($this->laravel, $request);
82 82
                 $this->laravel->bindRequest($laravelRequest);
Please login to merge, or discard this patch.
src/Swoole/Server.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
         $ip = isset($conf['listen_ip']) ? $conf['listen_ip'] : '127.0.0.1';
43 43
         $port = isset($conf['listen_port']) ? $conf['listen_port'] : 5200;
44
-        $socketType = isset($conf['socket_type']) ? (int)$conf['socket_type'] : SWOOLE_SOCK_TCP;
44
+        $socketType = isset($conf['socket_type']) ? (int) $conf['socket_type'] : SWOOLE_SOCK_TCP;
45 45
 
46 46
         if ($socketType === SWOOLE_SOCK_UNIX_STREAM) {
47 47
             $socketDir = dirname($ip);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
     protected function triggerWebSocketEvent($method, array $params)
99 99
     {
100
-        $this->callWithCatchException(function () use ($method, $params) {
100
+        $this->callWithCatchException(function() use ($method, $params) {
101 101
             $handler = $this->getWebSocketHandler();
102 102
 
103 103
             if (method_exists($handler, $method)) {
@@ -112,19 +112,19 @@  discard block
 block discarded – undo
112 112
     protected function bindWebSocketEvents()
113 113
     {
114 114
         if ($this->enableWebSocket) {
115
-            $this->swoole->on('HandShake', function () {
115
+            $this->swoole->on('HandShake', function() {
116 116
                 $this->triggerWebSocketEvent('onHandShake', func_get_args());
117 117
             });
118 118
 
119
-            $this->swoole->on('Open', function () {
119
+            $this->swoole->on('Open', function() {
120 120
                 $this->triggerWebSocketEvent('onOpen', func_get_args());
121 121
             });
122 122
 
123
-            $this->swoole->on('Message', function () {
123
+            $this->swoole->on('Message', function() {
124 124
                 $this->triggerWebSocketEvent('onMessage', func_get_args());
125 125
             });
126 126
 
127
-            $this->swoole->on('Close', function (WebSocketServer $server, $fd, $reactorId) {
127
+            $this->swoole->on('Close', function(WebSocketServer $server, $fd, $reactorId) {
128 128
                 $clientInfo = $server->getClientInfo($fd);
129 129
                 if (isset($clientInfo['websocket_status']) && $clientInfo['websocket_status'] === \WEBSOCKET_STATUS_FRAME) {
130 130
                     $this->triggerWebSocketEvent('onClose', func_get_args());
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
             $port->set(empty($socket['settings']) ? [] : $socket['settings']);
153 153
 
154 154
             $handlerClass = $socket['handler'];
155
-            $eventHandler = function ($method, array $params) use ($port, $handlerClass) {
155
+            $eventHandler = function($method, array $params) use ($port, $handlerClass) {
156 156
                 $handler = $this->getSocketHandler($port, $handlerClass);
157 157
                 if (method_exists($handler, $method)) {
158
-                    $this->callWithCatchException(function () use ($handler, $method, $params) {
158
+                    $this->callWithCatchException(function() use ($handler, $method, $params) {
159 159
                         call_user_func_array([$handler, $method], $params);
160 160
                     });
161 161
                 }
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
                 'BufferEmpty',
174 174
             ];
175 175
             foreach ($events as $event) {
176
-                $port->on($event, function () use ($event, $eventHandler) {
177
-                    $eventHandler('on' . $event, func_get_args());
176
+                $port->on($event, function() use ($event, $eventHandler) {
177
+                    $eventHandler('on'.$event, func_get_args());
178 178
                 });
179 179
             }
180 180
         }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
     protected function bindSwooleTables()
215 215
     {
216
-        $tables = isset($this->conf['swoole_tables']) ? (array)$this->conf['swoole_tables'] : [];
216
+        $tables = isset($this->conf['swoole_tables']) ? (array) $this->conf['swoole_tables'] : [];
217 217
         foreach ($tables as $name => $table) {
218 218
             $t = new Table($table['size']);
219 219
             foreach ($table['column'] as $column) {
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
         $headers = [
311 311
             'Upgrade'               => 'websocket',
312 312
             'Connection'            => 'Upgrade',
313
-            'Sec-WebSocket-Accept'  => base64_encode(sha1($key . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', true)),
313
+            'Sec-WebSocket-Accept'  => base64_encode(sha1($key.'258EAFA5-E914-47DA-95CA-C5AB0DC85B11', true)),
314 314
             'Sec-WebSocket-Version' => '13',
315 315
         ];
316 316
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         $response->end();
330 330
 
331 331
         if (method_exists($this->swoole, 'defer')) {
332
-            $this->swoole->defer(function () use ($request) {
332
+            $this->swoole->defer(function() use ($request) {
333 333
                 $this->triggerWebSocketEvent('onOpen', [$this->swoole, $request]);
334 334
             });
335 335
         } else {
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             if (!($listener instanceof Listener)) {
365 365
                 throw new \InvalidArgumentException(sprintf('%s must extend the abstract class %s', $listenerClass, Listener::class));
366 366
             }
367
-            $this->callWithCatchException(function () use ($listener) {
367
+            $this->callWithCatchException(function() use ($listener) {
368 368
                 $listener->handle();
369 369
             }, [], $event->getTries());
370 370
         }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
     protected function handleTask(Task $task)
375 375
     {
376
-        return $this->callWithCatchException(function () use ($task) {
376
+        return $this->callWithCatchException(function() use ($task) {
377 377
             $task->handle();
378 378
             return true;
379 379
         }, [], $task->getTries());
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     protected function fireEvent($event, $interface, array $arguments)
383 383
     {
384 384
         if (isset($this->conf['event_handlers'][$event])) {
385
-            $eventHandlers = (array)$this->conf['event_handlers'][$event];
385
+            $eventHandlers = (array) $this->conf['event_handlers'][$event];
386 386
             foreach ($eventHandlers as $eventHandler) {
387 387
                 if (!isset(class_implements($eventHandler)[$interface])) {
388 388
                     throw new \InvalidArgumentException(sprintf(
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
                         )
393 393
                     );
394 394
                 }
395
-                $this->callWithCatchException(function () use ($eventHandler, $arguments) {
395
+                $this->callWithCatchException(function() use ($eventHandler, $arguments) {
396 396
                     call_user_func_array([(new $eventHandler), 'handle'], $arguments);
397 397
                 });
398 398
             }
Please login to merge, or discard this patch.