Passed
Pull Request — master (#1048)
by
unknown
14:34
created
src/Helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         // and the values are on odd indexes. This way, we know which
27 27
         // ones are keys and which ones are values and their get combined
28 28
         // later to form the key => value array.
29
-        [$keys, $values] = collect($list)->partition(function ($value, $key) {
29
+        [$keys, $values] = collect($list)->partition(function($value, $key) {
30 30
             return $key % 2 === 0;
31 31
         });
32 32
 
Please login to merge, or discard this patch.
src/API/FetchChannels.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,27 +23,27 @@  discard block
 block discarded – undo
23 23
         if ($request->has('info')) {
24 24
             $attributes = explode(',', trim($request->info));
25 25
 
26
-            if (in_array('user_count', $attributes) && ! Str::startsWith($request->filter_by_prefix, 'presence-')) {
26
+            if (in_array('user_count', $attributes) && !Str::startsWith($request->filter_by_prefix, 'presence-')) {
27 27
                 throw new HttpException(400, 'Request must be limited to presence channels in order to fetch user_count');
28 28
             }
29 29
         }
30 30
 
31 31
         return $this->channelManager
32 32
             ->getGlobalChannels($request->appId)
33
-            ->then(function ($channels) use ($request, $attributes) {
34
-                $channels = collect($channels)->keyBy(function ($channel) {
33
+            ->then(function($channels) use ($request, $attributes) {
34
+                $channels = collect($channels)->keyBy(function($channel) {
35 35
                     return $channel instanceof Channel
36 36
                         ? $channel->getName()
37 37
                         : $channel;
38 38
                 });
39 39
 
40 40
                 if ($request->has('filter_by_prefix')) {
41
-                    $channels = $channels->filter(function ($channel, $channelName) use ($request) {
41
+                    $channels = $channels->filter(function($channel, $channelName) use ($request) {
42 42
                         return Str::startsWith($channelName, $request->filter_by_prefix);
43 43
                     });
44 44
                 }
45 45
 
46
-                $channelNames = $channels->map(function ($channel) {
46
+                $channelNames = $channels->map(function($channel) {
47 47
                     return $channel instanceof Channel
48 48
                         ? $channel->getName()
49 49
                         : $channel;
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 
52 52
                 return $this->channelManager
53 53
                     ->getChannelsMembersCount($request->appId, $channelNames)
54
-                    ->then(function ($counts) use ($channels, $attributes) {
55
-                        $channels = $channels->map(function ($channel) use ($counts, $attributes) {
54
+                    ->then(function($counts) use ($channels, $attributes) {
55
+                        $channels = $channels->map(function($channel) use ($counts, $attributes) {
56 56
                             $info = new stdClass;
57 57
 
58 58
                             $channelName = $channel instanceof Channel
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                             }
65 65
 
66 66
                             return $info;
67
-                        })->sortBy(function ($content, $name) {
67
+                        })->sortBy(function($content, $name) {
68 68
                             return $name;
69 69
                         })->all();
70 70
 
Please login to merge, or discard this patch.
src/API/FetchUsers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@
 block discarded – undo
16 16
      */
17 17
     public function __invoke(Request $request)
18 18
     {
19
-        if (! Str::startsWith($request->channelName, 'presence-')) {
19
+        if (!Str::startsWith($request->channelName, 'presence-')) {
20 20
             return new HttpException(400, "Invalid presence channel `{$request->channelName}`");
21 21
         }
22 22
 
23 23
         return $this->channelManager
24 24
             ->getChannelMembers($request->appId, $request->channelName)
25
-            ->then(function ($members) {
26
-                $users = collect($members)->map(function ($user) {
25
+            ->then(function($members) {
26
+                $users = collect($members)->map(function($user) {
27 27
                     return ['id' => $user->user_id];
28 28
                 })->values()->toArray();
29 29
 
Please login to merge, or discard this patch.
src/API/FetchChannel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
 
27 27
         return $this->channelManager
28 28
             ->getGlobalConnectionsCount($request->appId, $request->channelName)
29
-            ->then(function ($connectionsCount) use ($request) {
29
+            ->then(function($connectionsCount) use ($request) {
30 30
                 // For the presence channels, we need a slightly different response
31 31
                 // that need an additional call.
32 32
                 if (Str::startsWith($request->channelName, 'presence-')) {
33 33
                     return $this->channelManager
34 34
                         ->getChannelsMembersCount($request->appId, [$request->channelName])
35
-                        ->then(function ($channelMembers) use ($connectionsCount, $request) {
35
+                        ->then(function($channelMembers) use ($connectionsCount, $request) {
36 36
                             return [
37 37
                                 'occupied' => $connectionsCount > 0,
38 38
                                 'subscription_count' => $connectionsCount,
Please login to merge, or discard this patch.
src/Statistics/Collectors/RedisCollector.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                 $this->channelManager->getStatsRedisHash($appId, null),
86 86
                 'current_connections_count', 1
87 87
             )
88
-            ->then(function ($currentConnectionsCount) use ($appId) {
88
+            ->then(function($currentConnectionsCount) use ($appId) {
89 89
                 // Get the peak connections count from Redis.
90 90
                 $this->channelManager
91 91
                     ->getPublishClient()
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                         $this->channelManager->getStatsRedisHash($appId, null),
94 94
                         'peak_connections_count'
95 95
                     )
96
-                    ->then(function ($currentPeakConnectionCount) use ($currentConnectionsCount, $appId) {
96
+                    ->then(function($currentPeakConnectionCount) use ($currentConnectionsCount, $appId) {
97 97
                         // Extract the greatest number between the current peak connection count
98 98
                         // and the current connection number.
99 99
                         $peakConnectionsCount = is_null($currentPeakConnectionCount)
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
         // Decrement the current connections count by 1.
123 123
         $this->ensureAppIsInSet($appId)
124 124
             ->hincrby($this->channelManager->getStatsRedisHash($appId, null), 'current_connections_count', -1)
125
-            ->then(function ($currentConnectionsCount) use ($appId) {
125
+            ->then(function($currentConnectionsCount) use ($appId) {
126 126
                 // Get the peak connections count from Redis.
127 127
                 $this->channelManager
128 128
                     ->getPublishClient()
129 129
                     ->hget($this->channelManager->getStatsRedisHash($appId, null), 'peak_connections_count')
130
-                    ->then(function ($currentPeakConnectionCount) use ($currentConnectionsCount, $appId) {
130
+                    ->then(function($currentPeakConnectionCount) use ($currentConnectionsCount, $appId) {
131 131
                         // Extract the greatest number between the current peak connection count
132 132
                         // and the current connection number.
133 133
                         $peakConnectionsCount = is_null($currentPeakConnectionCount)
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function save()
154 154
     {
155
-        $this->lock()->get(function () {
155
+        $this->lock()->get(function() {
156 156
             $this->channelManager
157 157
                 ->getPublishClient()
158 158
                 ->smembers(static::$redisSetName)
159
-                ->then(function ($members) {
159
+                ->then(function($members) {
160 160
                     foreach ($members as $appId) {
161 161
                         $this->channelManager
162 162
                             ->getPublishClient()
163 163
                             ->hgetall($this->channelManager->getStatsRedisHash($appId, null))
164
-                            ->then(function ($list) use ($appId) {
165
-                                if (! $list) {
164
+                            ->then(function($list) use ($appId) {
165
+                                if (!$list) {
166 166
                                     return;
167 167
                                 }
168 168
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
                                 $this->channelManager
180 180
                                     ->getGlobalConnectionsCount($appId)
181
-                                    ->then(function ($currentConnectionsCount) use ($appId) {
181
+                                    ->then(function($currentConnectionsCount) use ($appId) {
182 182
                                         $currentConnectionsCount === 0 || is_null($currentConnectionsCount)
183 183
                                             ? $this->resetAppTraces($appId)
184 184
                                             : $this->resetStatistics($appId, $currentConnectionsCount);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public function flush()
198 198
     {
199
-        $this->getStatistics()->then(function ($statistics) {
199
+        $this->getStatistics()->then(function($statistics) {
200 200
             foreach ($statistics as $appId => $statistic) {
201 201
                 $this->resetAppTraces($appId);
202 202
             }
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
         return $this->channelManager
214 214
             ->getPublishClient()
215 215
             ->smembers(static::$redisSetName)
216
-            ->then(function ($members) {
216
+            ->then(function($members) {
217 217
                 $appsWithStatistics = [];
218 218
 
219 219
                 foreach ($members as $appId) {
220 220
                     $this->channelManager
221 221
                         ->getPublishClient()
222 222
                         ->hgetall($this->channelManager->getStatsRedisHash($appId, null))
223
-                        ->then(function ($list) use ($appId, &$appsWithStatistics) {
223
+                        ->then(function($list) use ($appId, &$appsWithStatistics) {
224 224
                             $appsWithStatistics[$appId] = $this->arrayToStatisticInstance(
225 225
                                 $appId, Helpers::redisListToArray($list)
226 226
                             );
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         return $this->channelManager
243 243
             ->getPublishClient()
244 244
             ->hgetall($this->channelManager->getStatsRedisHash($appId, null))
245
-            ->then(function ($list) use ($appId) {
245
+            ->then(function($list) use ($appId) {
246 246
                 return $this->arrayToStatisticInstance(
247 247
                     $appId, Helpers::redisListToArray($list)
248 248
                 );
Please login to merge, or discard this patch.
src/Statistics/Stores/DatabaseStore.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public static function delete(Carbon $moment, $appId = null): int
41 41
     {
42 42
         return static::$model::where('created_at', '<', $moment->toDateTimeString())
43
-            ->when(! is_null($appId), function ($query) use ($appId) {
43
+            ->when(!is_null($appId), function($query) use ($appId) {
44 44
                 return $query->whereAppId($appId);
45 45
             })
46 46
             ->delete();
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
     public function getRawRecords(callable $processQuery = null)
56 56
     {
57 57
         return static::$model::query()
58
-            ->when(! is_null($processQuery), function ($query) use ($processQuery) {
58
+            ->when(!is_null($processQuery), function($query) use ($processQuery) {
59 59
                 return call_user_func($processQuery, $query);
60
-            }, function ($query) {
60
+            }, function($query) {
61 61
                 return $query->latest()->limit(120);
62 62
             })->get();
63 63
     }
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
     public function getRecords(callable $processQuery = null, callable $processCollection = null): array
73 73
     {
74 74
         return $this->getRawRecords($processQuery)
75
-            ->when(! is_null($processCollection), function ($collection) use ($processCollection) {
75
+            ->when(!is_null($processCollection), function($collection) use ($processCollection) {
76 76
                 return call_user_func($processCollection, $collection);
77 77
             })
78
-            ->map(function (Model $statistic) {
78
+            ->map(function(Model $statistic) {
79 79
                 return $this->statisticToArray($statistic);
80 80
             })
81 81
             ->toArray();
Please login to merge, or discard this patch.
src/Server/Messages/PusherClientMessage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@
 block discarded – undo
53 53
      */
54 54
     public function respond()
55 55
     {
56
-        if (! Str::startsWith($this->payload->event, 'client-')) {
56
+        if (!Str::startsWith($this->payload->event, 'client-')) {
57 57
             return;
58 58
         }
59 59
 
60
-        if (! $this->connection->app->clientMessagesEnabled) {
60
+        if (!$this->connection->app->clientMessagesEnabled) {
61 61
             return;
62 62
         }
63 63
 
Please login to merge, or discard this patch.
src/Server/Messages/PusherChannelProtocolMessage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     {
36 36
         $this->channelManager
37 37
             ->connectionPonged($connection)
38
-            ->then(function () use ($connection) {
38
+            ->then(function() use ($connection) {
39 39
                 $connection->send(json_encode(['event' => 'pusher:pong']));
40 40
 
41 41
                 ConnectionPonged::dispatch($connection->app->id, $connection->socketId);
Please login to merge, or discard this patch.
src/Server/Router.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@
 block discarded – undo
175 175
     public function registerCustomRoutes()
176 176
     {
177 177
         foreach ($this->customRoutes as $method => $actions) {
178
-            $actions->each(function ($action, $uri) use ($method) {
178
+            $actions->each(function($action, $uri) use ($method) {
179 179
                 $this->{$method}($uri, $action);
180 180
             });
181 181
         }
Please login to merge, or discard this patch.