Passed
Pull Request — master (#322)
by
unknown
04:03
created
src/Swoole/AbstractWebSocketHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
         $key = base64_encode(
23 23
             sha1(
24
-                $request->header['sec-websocket-key'] . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',
24
+                $request->header['sec-websocket-key'].'258EAFA5-E914-47DA-95CA-C5AB0DC85B11',
25 25
                 true
26 26
             )
27 27
         );
Please login to merge, or discard this patch.
src/Swoole/Server.php 1 patch
Spacing   +16 added lines, -16 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);
@@ -98,25 +98,25 @@  discard block
 block discarded – undo
98 98
     protected function bindWebSocketEvent()
99 99
     {
100 100
         if ($this->enableWebSocket) {
101
-            $eventHandler = function ($method, array $params) {
102
-                $this->callWithCatchException(function () use ($method, $params) {
101
+            $eventHandler = function($method, array $params) {
102
+                $this->callWithCatchException(function() use ($method, $params) {
103 103
                     call_user_func_array([$this->getWebSocketHandler(), $method], $params);
104 104
                 });
105 105
             };
106 106
 
107
-            $this->swoole->on('Handshake', function () use ($eventHandler){
107
+            $this->swoole->on('Handshake', function() use ($eventHandler){
108 108
                 $eventHandler('onHandshake', func_get_args());
109 109
             });
110 110
 
111
-            $this->swoole->on('Open', function () use ($eventHandler) {
111
+            $this->swoole->on('Open', function() use ($eventHandler) {
112 112
                 $eventHandler('onOpen', func_get_args());
113 113
             });
114 114
 
115
-            $this->swoole->on('Message', function () use ($eventHandler) {
115
+            $this->swoole->on('Message', function() use ($eventHandler) {
116 116
                 $eventHandler('onMessage', func_get_args());
117 117
             });
118 118
 
119
-            $this->swoole->on('Close', function (WebSocketServer $server, $fd, $reactorId) use ($eventHandler) {
119
+            $this->swoole->on('Close', function(WebSocketServer $server, $fd, $reactorId) use ($eventHandler) {
120 120
                 $clientInfo = $server->getClientInfo($fd);
121 121
                 if (isset($clientInfo['websocket_status']) && $clientInfo['websocket_status'] === \WEBSOCKET_STATUS_FRAME) {
122 122
                     $eventHandler('onClose', func_get_args());
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
             $port->set(empty($socket['settings']) ? [] : $socket['settings']);
145 145
 
146 146
             $handlerClass = $socket['handler'];
147
-            $eventHandler = function ($method, array $params) use ($port, $handlerClass) {
147
+            $eventHandler = function($method, array $params) use ($port, $handlerClass) {
148 148
                 $handler = $this->getSocketHandler($port, $handlerClass);
149 149
                 if (method_exists($handler, $method)) {
150
-                    $this->callWithCatchException(function () use ($handler, $method, $params) {
150
+                    $this->callWithCatchException(function() use ($handler, $method, $params) {
151 151
                         call_user_func_array([$handler, $method], $params);
152 152
                     });
153 153
                 }
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
                 'BufferEmpty',
165 165
             ];
166 166
             foreach ($events as $event) {
167
-                $port->on($event, function () use ($event, $eventHandler) {
168
-                    $eventHandler('on' . $event, func_get_args());
167
+                $port->on($event, function() use ($event, $eventHandler) {
168
+                    $eventHandler('on'.$event, func_get_args());
169 169
                 });
170 170
             }
171 171
         }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 
205 205
     protected function bindSwooleTables()
206 206
     {
207
-        $tables = isset($this->conf['swoole_tables']) ? (array)$this->conf['swoole_tables'] : [];
207
+        $tables = isset($this->conf['swoole_tables']) ? (array) $this->conf['swoole_tables'] : [];
208 208
         foreach ($tables as $name => $table) {
209 209
             $t = new Table($table['size']);
210 210
             foreach ($table['column'] as $column) {
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             if (!($listener instanceof Listener)) {
312 312
                 throw new \InvalidArgumentException(sprintf('%s must extend the abstract class %s', $listenerClass, Listener::class));
313 313
             }
314
-            $this->callWithCatchException(function () use ($listener) {
314
+            $this->callWithCatchException(function() use ($listener) {
315 315
                 $listener->handle();
316 316
             }, [], $event->getTries());
317 317
         }
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
     protected function handleTask(Task $task)
322 322
     {
323
-        return $this->callWithCatchException(function () use ($task) {
323
+        return $this->callWithCatchException(function() use ($task) {
324 324
             $task->handle();
325 325
             return true;
326 326
         }, [], $task->getTries());
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
     protected function fireEvent($event, $interface, array $arguments)
330 330
     {
331 331
         if (isset($this->conf['event_handlers'][$event])) {
332
-            $eventHandlers = (array)$this->conf['event_handlers'][$event];
332
+            $eventHandlers = (array) $this->conf['event_handlers'][$event];
333 333
             foreach ($eventHandlers as $eventHandler) {
334 334
                 if (!isset(class_implements($eventHandler)[$interface])) {
335 335
                     throw new \InvalidArgumentException(sprintf(
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
                         )
340 340
                     );
341 341
                 }
342
-                $this->callWithCatchException(function () use ($eventHandler, $arguments) {
342
+                $this->callWithCatchException(function() use ($eventHandler, $arguments) {
343 343
                     call_user_func_array([(new $eventHandler), 'handle'], $arguments);
344 344
                 });
345 345
             }
Please login to merge, or discard this patch.