Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 11e1f89

Browse files
Merge pull request #1 from deviouspk/analysis-z3nD5L
Apply fixes from StyleCI
1 parent d43ac82 commit 11e1f89

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

src/Console/StartWebSocketServer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ protected function registerEchoRoutes()
116116
protected function registerCustomRoutes()
117117
{
118118
WebSocketsRouter::customRoutes();
119+
119120
return $this;
120121
}
121122

src/PubSub/Drivers/EmptyClient.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
class EmptyClient implements ReplicationInterface
1212
{
13-
1413
/**
1514
* Boot the pub/sub provider (open connections, initial subscriptions, etc).
1615
*
@@ -70,7 +69,6 @@ public function unsubscribe(string $appId, string $channel) : bool
7069
*/
7170
public function joinChannel(string $appId, string $channel, string $socketId, string $data)
7271
{
73-
7472
}
7573

7674
/**
@@ -83,7 +81,6 @@ public function joinChannel(string $appId, string $channel, string $socketId, st
8381
*/
8482
public function leaveChannel(string $appId, string $channel, string $socketId)
8583
{
86-
8784
}
8885

8986
/**

src/WebSockets/Channels/Channel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function verifySignature(ConnectionInterface $connection, stdClass $pa
5252
$signature .= ":{$payload->channel_data}";
5353
}
5454

55-
if (!hash_equals(
55+
if (! hash_equals(
5656
hash_hmac('sha256', $signature, $connection->app->secret),
5757
Str::after($payload->auth, ':'))
5858
) {
@@ -83,7 +83,7 @@ public function unsubscribe(ConnectionInterface $connection)
8383
// Unsubscribe from the pub/sub backend
8484
$this->pubSub->unsubscribe($connection->app->id, $this->channelName);
8585

86-
if (!$this->hasConnections()) {
86+
if (! $this->hasConnections()) {
8787
DashboardLogger::vacated($connection, $this->channelName);
8888
}
8989
}
@@ -94,7 +94,7 @@ protected function saveConnection(ConnectionInterface $connection)
9494

9595
$this->subscribedConnections[$connection->socketId] = $connection;
9696

97-
if (!$hadConnectionsPreviously) {
97+
if (! $hadConnectionsPreviously) {
9898
DashboardLogger::occupied($connection, $this->channelName);
9999
}
100100

src/WebSocketsServiceProvider.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
namespace BeyondCode\LaravelWebSockets;
44

5-
use BeyondCode\LaravelWebSockets\PubSub\Broadcasters\RedisPusherBroadcaster;
6-
use BeyondCode\LaravelWebSockets\PubSub\Drivers\EmptyClient;
7-
use BeyondCode\LaravelWebSockets\PubSub\Drivers\RedisClient;
8-
use BeyondCode\LaravelWebSockets\PubSub\ReplicationInterface;
95
use Pusher\Pusher;
106
use Psr\Log\LoggerInterface;
117
use Illuminate\Support\Facades\Gate;
@@ -14,9 +10,13 @@
1410
use Illuminate\Broadcasting\BroadcastManager;
1511
use BeyondCode\LaravelWebSockets\Server\Router;
1612
use BeyondCode\LaravelWebSockets\Apps\AppProvider;
13+
use BeyondCode\LaravelWebSockets\PubSub\Drivers\EmptyClient;
14+
use BeyondCode\LaravelWebSockets\PubSub\Drivers\RedisClient;
15+
use BeyondCode\LaravelWebSockets\PubSub\ReplicationInterface;
1716
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
1817
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\SendMessage;
1918
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\ShowDashboard;
19+
use BeyondCode\LaravelWebSockets\PubSub\Broadcasters\RedisPusherBroadcaster;
2020
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\AuthenticateDashboard;
2121
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\DashboardApiController;
2222
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers\ArrayChannelManager;
@@ -29,36 +29,36 @@ class WebSocketsServiceProvider extends ServiceProvider
2929
public function boot()
3030
{
3131
$this->publishes([
32-
__DIR__ . '/../config/websockets.php' => base_path('config/websockets.php'),
32+
__DIR__.'/../config/websockets.php' => base_path('config/websockets.php'),
3333
], 'config');
3434

35-
if (!class_exists('CreateWebSocketsStatisticsEntries')) {
35+
if (! class_exists('CreateWebSocketsStatisticsEntries')) {
3636
$this->publishes([
37-
__DIR__ . '/../database/migrations/create_websockets_statistics_entries_table.php.stub' => database_path('migrations/' . date('Y_m_d_His', time()) . '_create_websockets_statistics_entries_table.php'),
37+
__DIR__.'/../database/migrations/create_websockets_statistics_entries_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_websockets_statistics_entries_table.php'),
3838
], 'migrations');
3939
}
4040

4141
$this
4242
->registerRoutes()
4343
->registerDashboardGate();
4444

45-
$this->loadViewsFrom(__DIR__ . '/../resources/views/', 'websockets');
45+
$this->loadViewsFrom(__DIR__.'/../resources/views/', 'websockets');
4646

4747
$this->commands([
4848
Console\StartWebSocketServer::class,
4949
Console\CleanStatistics::class,
5050
]);
5151

5252
$this->configurePubSub();
53-
5453
}
5554

5655
protected function configurePubSub()
5756
{
5857
if (config('websockets.replication.enabled') !== true || config('websockets.replication.driver') !== 'redis') {
5958
$this->app->singleton(ReplicationInterface::class, function () {
60-
return (new EmptyClient());
59+
return new EmptyClient();
6160
});
61+
6262
return;
6363
}
6464

@@ -87,7 +87,7 @@ protected function configurePubSub()
8787

8888
public function register()
8989
{
90-
$this->mergeConfigFrom(__DIR__ . '/../config/websockets.php', 'websockets');
90+
$this->mergeConfigFrom(__DIR__.'/../config/websockets.php', 'websockets');
9191

9292
$this->app->singleton('websockets.router', function () {
9393
return new Router();

tests/TestsReplication.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace BeyondCode\LaravelWebSockets\Tests;
44

5-
use BeyondCode\LaravelWebSockets\Tests\Mocks\FakeReplicationClient;
6-
use Illuminate\Support\Facades\Config;
75
use React\EventLoop\Factory;
6+
use Illuminate\Support\Facades\Config;
87
use BeyondCode\LaravelWebSockets\PubSub\ReplicationInterface;
8+
use BeyondCode\LaravelWebSockets\Tests\Mocks\FakeReplicationClient;
99

1010
trait TestsReplication
1111
{

0 commit comments

Comments
 (0)