From 6f09751615d156716800797c10e7c563ea840902 Mon Sep 17 00:00:00 2001 From: joedixon Date: Fri, 21 Apr 2023 12:45:05 +0000 Subject: [PATCH] Fix code styling --- src/Managers/ChannelManager.php | 2 +- src/Servers/ApiGateway/Request.php | 12 ++++++------ src/Servers/ApiGateway/Server.php | 16 ++++++++-------- src/Servers/Ratchet/Server.php | 18 +++++++++--------- tests/Unit/Jobs/PruneStaleConnectionsTest.php | 4 ++-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Managers/ChannelManager.php b/src/Managers/ChannelManager.php index 30bd4a5b..f59e5d6a 100644 --- a/src/Managers/ChannelManager.php +++ b/src/Managers/ChannelManager.php @@ -48,7 +48,7 @@ public function subscribe(Channel $channel, Connection $connection, $data = []): { $this->mutex(function () use ($channel, $connection, $data) { $connections = $this->connectionKeys($channel) - ->put($connection->identifier(), $data); + ->put($connection->identifier(), $data); $this->syncConnections($channel, $connections); }); diff --git a/src/Servers/ApiGateway/Request.php b/src/Servers/ApiGateway/Request.php index 47b46e03..ebd61690 100644 --- a/src/Servers/ApiGateway/Request.php +++ b/src/Servers/ApiGateway/Request.php @@ -97,13 +97,13 @@ protected static function getQueryString(array $event): string if (isset($event['version']) && $event['version'] === '2.0') { return http_build_query( collect($event['queryStringParameters'] ?? []) - ->mapWithKeys(function ($value, $key) { - $values = explode(',', $value); + ->mapWithKeys(function ($value, $key) { + $values = explode(',', $value); - return count($values) === 1 - ? [$key => $values[0]] - : [(substr($key, -2) == '[]' ? substr($key, 0, -2) : $key) => $values]; - })->all() + return count($values) === 1 + ? [$key => $values[0]] + : [(substr($key, -2) == '[]' ? substr($key, 0, -2) : $key) => $values]; + })->all() ); } diff --git a/src/Servers/ApiGateway/Server.php b/src/Servers/ApiGateway/Server.php index 9d5d97bb..8252bb4d 100644 --- a/src/Servers/ApiGateway/Server.php +++ b/src/Servers/ApiGateway/Server.php @@ -55,15 +55,15 @@ public function handle(Request $request): void protected function connect(Request $request): Connection { return $this->connections - ->for($application = $this->application($request)) - ->resolve( + ->for($application = $this->application($request)) + ->resolve( + $request->connectionId(), + fn () => new Connection( $request->connectionId(), - fn () => new Connection( - $request->connectionId(), - $application, - $request->headers['origin'] ?? null - ) - ); + $application, + $request->headers['origin'] ?? null + ) + ); } /** diff --git a/src/Servers/Ratchet/Server.php b/src/Servers/Ratchet/Server.php index 5090ad8a..44688403 100644 --- a/src/Servers/Ratchet/Server.php +++ b/src/Servers/Ratchet/Server.php @@ -82,15 +82,15 @@ protected function connection(ConnectionInterface $connection): Connection $application = $this->application($connection); return $this->connections - ->for($application) - ->resolve( - $connection->resourceId, - fn () => new Connection( - $connection, - $application, - $connection->httpRequest->getHeader('Origin')[0] ?? null - ) - ); + ->for($application) + ->resolve( + $connection->resourceId, + fn () => new Connection( + $connection, + $application, + $connection->httpRequest->getHeader('Origin')[0] ?? null + ) + ); } /** diff --git a/tests/Unit/Jobs/PruneStaleConnectionsTest.php b/tests/Unit/Jobs/PruneStaleConnectionsTest.php index e5490c2b..e4498854 100644 --- a/tests/Unit/Jobs/PruneStaleConnectionsTest.php +++ b/tests/Unit/Jobs/PruneStaleConnectionsTest.php @@ -31,8 +31,8 @@ $connection->setHasBeenPinged(); $this->channelManager->shouldReceive('unsubscribeFromAll') - ->once() - ->with($connection); + ->once() + ->with($connection); }); (new PruneStaleConnections)->handle(