Passed
Push — master ( 605a7f...c53e78 )
by Marcel
14:27 queued 03:25
created
src/ChannelManagers/LocalChannelManager.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function findOrCreate($appId, string $channel)
104 104
     {
105
-        if (! $channelInstance = $this->find($appId, $channel)) {
105
+        if (!$channelInstance = $this->find($appId, $channel)) {
106 106
             $class = $this->getChannelClassName($channel);
107 107
 
108 108
             $this->channels[$appId][$channel] = new $class($channel);
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
     public function getLocalConnections(): PromiseInterface
121 121
     {
122 122
         $connections = collect($this->channels)
123
-            ->map(function ($channelsWithConnections, $appId) {
123
+            ->map(function($channelsWithConnections, $appId) {
124 124
                 return collect($channelsWithConnections)->values();
125 125
             })
126 126
             ->values()->collapse()
127
-            ->map(function ($channel) {
127
+            ->map(function($channel) {
128 128
                 return collect($channel->getConnections());
129 129
             })
130 130
             ->values()->collapse()
@@ -167,28 +167,28 @@  discard block
 block discarded – undo
167 167
      */
168 168
     public function unsubscribeFromAllChannels(ConnectionInterface $connection): PromiseInterface
169 169
     {
170
-        if (! isset($connection->app)) {
170
+        if (!isset($connection->app)) {
171 171
             return Helpers::createFulfilledPromise(false);
172 172
         }
173 173
 
174 174
         $this->getLocalChannels($connection->app->id)
175
-            ->then(function ($channels) use ($connection) {
175
+            ->then(function($channels) use ($connection) {
176 176
                 collect($channels)
177
-                    ->each(function (Channel $channel) use ($connection) {
177
+                    ->each(function(Channel $channel) use ($connection) {
178 178
                         $channel->unsubscribe($connection);
179 179
                     });
180 180
 
181 181
                 collect($channels)
182
-                    ->reject(function ($channel) {
182
+                    ->reject(function($channel) {
183 183
                         return $channel->hasConnections();
184 184
                     })
185
-                    ->each(function (Channel $channel, string $channelName) use ($connection) {
185
+                    ->each(function(Channel $channel, string $channelName) use ($connection) {
186 186
                         unset($this->channels[$connection->app->id][$channelName]);
187 187
                     });
188 188
             });
189 189
 
190 190
         $this->getLocalChannels($connection->app->id)
191
-            ->then(function ($channels) use ($connection) {
191
+            ->then(function($channels) use ($connection) {
192 192
                 if (count($channels) === 0) {
193 193
                     unset($this->channels[$connection->app->id]);
194 194
                 }
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
     public function getLocalConnectionsCount($appId, string $channelName = null): PromiseInterface
267 267
     {
268 268
         return $this->getLocalChannels($appId)
269
-            ->then(function ($channels) use ($channelName) {
270
-                return collect($channels)->when(! is_null($channelName), function ($collection) use ($channelName) {
271
-                    return $collection->filter(function (Channel $channel) use ($channelName) {
269
+            ->then(function($channels) use ($channelName) {
270
+                return collect($channels)->when(!is_null($channelName), function($collection) use ($channelName) {
271
+                    return $collection->filter(function(Channel $channel) use ($channelName) {
272 272
                         return $channel->getName() === $channelName;
273 273
                     });
274 274
                 })
275
-                    ->flatMap(function (Channel $channel) {
275
+                    ->flatMap(function(Channel $channel) {
276 276
                         return collect($channel->getConnections())->pluck('socketId');
277 277
                     })
278 278
                     ->unique()->count();
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
     {
365 365
         $members = $this->users["{$appId}:{$channel}"] ?? [];
366 366
 
367
-        $members = collect($members)->map(function ($user) {
367
+        $members = collect($members)->map(function($user) {
368 368
             return json_decode($user);
369 369
         })->unique('user_id')->toArray();
370 370
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     public function getChannelsMembersCount($appId, array $channelNames): PromiseInterface
396 396
     {
397 397
         $results = collect($channelNames)
398
-            ->reduce(function ($results, $channel) use ($appId) {
398
+            ->reduce(function($results, $channel) use ($appId) {
399 399
                 $results[$channel] = isset($this->users["{$appId}:{$channel}"])
400 400
                     ? count($this->users["{$appId}:{$channel}"])
401 401
                     : 0;
@@ -441,11 +441,11 @@  discard block
 block discarded – undo
441 441
     {
442 442
         $lock = $this->lock();
443 443
         try {
444
-            if (! $lock->acquire()) {
444
+            if (!$lock->acquire()) {
445 445
                 return Helpers::createFulfilledPromise(false);
446 446
             }
447 447
 
448
-            $this->getLocalConnections()->then(function ($connections) {
448
+            $this->getLocalConnections()->then(function($connections) {
449 449
                 foreach ($connections as $connection) {
450 450
                     $differenceInSeconds = $connection->lastPongedAt->diffInSeconds(Carbon::now());
451 451
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
     public function pongConnectionInChannels(ConnectionInterface $connection): PromiseInterface
471 471
     {
472 472
         return $this->getLocalChannels($connection->app->id)
473
-            ->then(function ($channels) use ($connection) {
473
+            ->then(function($channels) use ($connection) {
474 474
                 foreach ($channels as $channel) {
475 475
                     if ($conn = $channel->getConnection($connection->socketId)) {
476 476
                         $conn->lastPongedAt = Carbon::now();
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     public function updateConnectionInChannels($connection): PromiseInterface
492 492
     {
493 493
         return $this->getLocalChannels($connection->app->id)
494
-            ->then(function ($channels) use ($connection) {
494
+            ->then(function($channels) use ($connection) {
495 495
                 foreach ($channels as $channel) {
496 496
                     if ($channel->hasConnection($connection)) {
497 497
                         $channel->saveConnection($connection);
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.
src/Server/Loggers/Logger.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
      */
97 97
     protected function warn(string $message)
98 98
     {
99
-        if (! $this->consoleOutput->getFormatter()->hasStyle('warning')) {
99
+        if (!$this->consoleOutput->getFormatter()->hasStyle('warning')) {
100 100
             $style = new OutputFormatterStyle('yellow');
101 101
 
102 102
             $this->consoleOutput->getFormatter()->setStyle('warning', $style);
Please login to merge, or discard this patch.
src/Server/WebSocketHandler.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function onOpen(ConnectionInterface $connection)
44 44
     {
45
-        if (! $this->connectionCanBeMade($connection)) {
45
+        if (!$this->connectionCanBeMade($connection)) {
46 46
             return $connection->close();
47 47
         }
48 48
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function onMessage(ConnectionInterface $connection, MessageInterface $message)
84 84
     {
85
-        if (! isset($connection->app)) {
85
+        if (!isset($connection->app)) {
86 86
             return;
87 87
         }
88 88
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $this->channelManager
113 113
             ->unsubscribeFromAllChannels($connection)
114
-            ->then(function (bool $unsubscribed) use ($connection) {
114
+            ->then(function(bool $unsubscribed) use ($connection) {
115 115
                 if (isset($connection->app)) {
116 116
                     if ($connection->app->statisticsEnabled) {
117 117
                         StatisticsCollector::disconnection($connection->app->id);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         $appKey = $query->get('appKey');
170 170
 
171
-        if (! $app = App::findByKey($appKey)) {
171
+        if (!$app = App::findByKey($appKey)) {
172 172
             throw new Exceptions\UnknownAppKey($appKey);
173 173
         }
174 174
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     protected function verifyOrigin(ConnectionInterface $connection)
187 187
     {
188
-        if (! $connection->app->allowedOrigins) {
188
+        if (!$connection->app->allowedOrigins) {
189 189
             return $this;
190 190
         }
191 191
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
         $origin = parse_url($header, PHP_URL_HOST) ?: $header;
195 195
 
196
-        if (! $header || ! in_array($origin, $connection->app->allowedOrigins)) {
196
+        if (!$header || !in_array($origin, $connection->app->allowedOrigins)) {
197 197
             throw new Exceptions\OriginNotAllowed($connection->app->key);
198 198
         }
199 199
 
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
      */
209 209
     protected function limitConcurrentConnections(ConnectionInterface $connection)
210 210
     {
211
-        if (! is_null($capacity = $connection->app->capacity)) {
211
+        if (!is_null($capacity = $connection->app->capacity)) {
212 212
             $this->channelManager
213 213
                 ->getGlobalConnectionsCount($connection->app->id)
214
-                ->then(function ($connectionsCount) use ($capacity, $connection) {
214
+                ->then(function($connectionsCount) use ($capacity, $connection) {
215 215
                     if ($connectionsCount >= $capacity) {
216 216
                         $exception = new Exceptions\ConnectionsOverCapacity;
217 217
 
Please login to merge, or discard this patch.
src/Apps/ConfigAppManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function all(): array
32 32
     {
33 33
         return $this->apps
34
-            ->map(function (array $appAttributes) {
34
+            ->map(function(array $appAttributes) {
35 35
                 return $this->convertIntoApp($appAttributes);
36 36
             })
37 37
             ->toArray();
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     protected function convertIntoApp(?array $appAttributes): ?App
86 86
     {
87
-        if (! $appAttributes) {
87
+        if (!$appAttributes) {
88 88
             return null;
89 89
         }
90 90
 
Please login to merge, or discard this patch.
src/Dashboard/Http/Controllers/ShowStatistics.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@
 block discarded – undo
16 16
      */
17 17
     public function __invoke(Request $request, $appId)
18 18
     {
19
-        $processQuery = function ($query) use ($appId) {
19
+        $processQuery = function($query) use ($appId) {
20 20
             return $query->whereAppId($appId)
21 21
                 ->latest()
22 22
                 ->limit(120);
23 23
         };
24 24
 
25
-        $processCollection = function ($collection) {
25
+        $processCollection = function($collection) {
26 26
             return $collection->reverse();
27 27
         };
28 28
 
Please login to merge, or discard this patch.
src/Channels/Channel.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function unsubscribe(ConnectionInterface $connection): bool
122 122
     {
123
-        if (! $this->hasConnection($connection)) {
123
+        if (!$this->hasConnection($connection)) {
124 124
             return false;
125 125
         }
126 126
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     public function broadcast($appId, stdClass $payload, bool $replicate = true): bool
169 169
     {
170 170
         collect($this->getConnections())
171
-            ->each(function ($connection) use ($payload) {
171
+            ->each(function($connection) use ($payload) {
172 172
                 $connection->send(json_encode($payload));
173 173
                 $this->channelManager->connectionPonged($connection);
174 174
             });
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             return $this->broadcast($appId, $payload, false);
212 212
         }
213 213
 
214
-        collect($this->getConnections())->each(function (ConnectionInterface $connection) use ($socketId, $payload) {
214
+        collect($this->getConnections())->each(function(ConnectionInterface $connection) use ($socketId, $payload) {
215 215
             if ($connection->socketId !== $socketId) {
216 216
                 $connection->send(json_encode($payload));
217 217
                 $this->channelManager->connectionPonged($connection);
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
             $signature .= ":{$payload->channel_data}";
254 254
         }
255 255
 
256
-        if (! hash_equals(
256
+        if (!hash_equals(
257 257
             hash_hmac('sha256', $signature, $connection->app->secret),
258 258
             Str::after($payload->auth, ':'))
259 259
         ) {
Please login to merge, or discard this patch.