Passed
Push — master ( 9dff9d...cbb991 )
by Albert
03:26
created
src/Controllers/SocketIOController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 
11 11
     public function upgrade(Request $request)
12 12
     {
13
-        if (! in_array($request->input('transport'), $this->transports)) {
13
+        if (!in_array($request->input('transport'), $this->transports)) {
14 14
             return response()->json([
15 15
                 'code' => 0,
16 16
                 'message' => 'Transport unknown'
Please login to merge, or discard this patch.
src/Websocket/SocketIO/Packet.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
     {
108 108
         $type = $packet[0] ?? null;
109 109
 
110
-        if (! array_key_exists($type, static::$socketTypes)) {
110
+        if (!array_key_exists($type, static::$socketTypes)) {
111 111
             return null;
112 112
         }
113 113
 
Please login to merge, or discard this patch.
src/Websocket/SocketIO/WebsocketHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      */
19 19
     public function onOpen($fd, Request $request)
20 20
     {
21
-        if (! $request->input('sid')) {
21
+        if (!$request->input('sid')) {
22 22
             $payload = json_encode([
23 23
                 'sid' => base64_encode(uniqid()),
24 24
                 'upgrades' => [],
Please login to merge, or discard this patch.
src/Websocket/Authenticatable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $users = is_object($users) ? func_get_args() : $users;
46 46
 
47
-        $userIds = array_map(function ($user) {
47
+        $userIds = array_map(function($user) {
48 48
             $this->checkUser($user);
49 49
             return $user->getAuthIdentifier();
50 50
         }, $users);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function getUserId()
74 74
     {
75
-        if (! is_null($this->userId)) {
75
+        if (!is_null($this->userId)) {
76 76
             return $this->userId;
77 77
         }
78 78
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function isUserIdOnline($userId)
94 94
     {
95
-        return ! empty($this->room->getClients(static::USER_PREFIX . $userId));
95
+        return !empty($this->room->getClients(static::USER_PREFIX . $userId));
96 96
     }
97 97
 
98 98
     /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     protected function checkUser($user)
102 102
     {
103
-        if (! $user instanceOf AuthenticatableContract) {
103
+        if (!$user instanceOf AuthenticatableContract) {
104 104
             throw new InvalidArgumentException('user object must implement ' . AuthenticatableContract::class);
105 105
         }
106 106
     }
Please login to merge, or discard this patch.
src/Websocket/Middleware/StartSession.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function startSession(Request $request)
55 55
     {
56
-        return tap($this->getSession($request), function ($session) use ($request) {
56
+        return tap($this->getSession($request), function($session) use ($request) {
57 57
             $session->setRequestOnHandler($request);
58 58
 
59 59
             $session->start();
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function getSession(Request $request)
70 70
     {
71
-        return tap($this->manager->driver(), function ($session) use ($request) {
71
+        return tap($this->manager->driver(), function($session) use ($request) {
72 72
             $session->setId($request->cookies->get($session->getName()));
73 73
         });
74 74
     }
@@ -80,6 +80,6 @@  discard block
 block discarded – undo
80 80
      */
81 81
     protected function sessionConfigured()
82 82
     {
83
-        return ! is_null($this->manager->getSessionConfig()['driver'] ?? null);
83
+        return !is_null($this->manager->getSessionConfig()['driver'] ?? null);
84 84
     }
85 85
 }
Please login to merge, or discard this patch.
src/Websocket/Middleware/Authenticate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     {
40 40
         try {
41 41
             if ($user = $this->auth->authenticate()) {
42
-                $request->setUserResolver(function () use ($user) {
42
+                $request->setUserResolver(function() use ($user) {
43 43
                     return $user;
44 44
                 });
45 45
             }
Please login to merge, or discard this patch.
src/Websocket/Websocket.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $values = is_string($values) || is_integer($values) ? func_get_args() : $values;
100 100
 
101 101
         foreach ($values as $value) {
102
-            if (! in_array($value, $this->to)) {
102
+            if (!in_array($value, $this->to)) {
103 103
                 $this->to[] = $value;
104 104
             }
105 105
         }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     public function emit(string $event, $data)
145 145
     {
146 146
         $fds = $this->getFds();
147
-        $assigned = ! empty($this->to);
147
+        $assigned = !empty($this->to);
148 148
 
149 149
         // if no fds are found, but rooms are assigned
150 150
         // that means trying to emit to a non-existing room
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      */
191 191
     public function on(string $event, $callback)
192 192
     {
193
-        if (! is_string($callback) && ! is_callable($callback)) {
193
+        if (!is_string($callback) && !is_callable($callback)) {
194 194
             throw new InvalidArgumentException(
195 195
                 'Invalid websocket callback. Must be a string or callable.'
196 196
             );
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      */
220 220
     public function call(string $event, $data = null)
221 221
     {
222
-        if (! $this->eventExists($event)) {
222
+        if (!$this->eventExists($event)) {
223 223
             return null;
224 224
         }
225 225
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      */
290 290
     protected function getFds()
291 291
     {
292
-        $fds = array_filter($this->to, function ($value) {
292
+        $fds = array_filter($this->to, function($value) {
293 293
             return is_integer($value);
294 294
         });
295 295
         $rooms = array_diff($this->to, $fds);
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     {
357 357
         $pipeline = $this->pipeline;
358 358
 
359
-        $closure = function () use ($container) {
359
+        $closure = function() use ($container) {
360 360
             $this->container = $container;
361 361
         };
362 362
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         return $this->pipeline
376 376
             ->send($request)
377 377
             ->through($this->middleware)
378
-            ->then(function ($request) {
378
+            ->then(function($request) {
379 379
                 return $request;
380 380
             });
381 381
     }
Please login to merge, or discard this patch.
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.