Skip to content

Commit 9ce2cc3

Browse files
authored
Apply fixes from StyleCI (beyondcode#3)
1 parent b3e5df4 commit 9ce2cc3

File tree

69 files changed

+288
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+288
-328
lines changed

config/websockets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
* When the clean-command is executed, all recorded statistics older than
6565
* the number of days specified here will be deleted.
6666
*/
67-
'delete_statistics_older_than_days' => 60
67+
'delete_statistics_older_than_days' => 60,
6868
],
6969

7070
/*
@@ -89,6 +89,6 @@
8989
/*
9090
* Passphrase for your local_cert file.
9191
*/
92-
'passphrase' => null
92+
'passphrase' => null,
9393
],
9494
];

src/Apps/App.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public static function findById($appId)
2929
return app(AppProvider::class)->findById($appId);
3030
}
3131

32-
public static function findByKey(string $appKey): ?App
32+
public static function findByKey(string $appKey): ?self
3333
{
3434
return app(AppProvider::class)->findByKey($appKey);
3535
}
3636

37-
public static function findBySecret(string $appSecret): ?App
37+
public static function findBySecret(string $appSecret): ?self
3838
{
3939
return app(AppProvider::class)->findBySecret($appSecret);
4040
}

src/Apps/AppProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ public function findById($appId): ?App;
1212
public function findByKey(string $appKey): ?App;
1313

1414
public function findBySecret(string $appSecret): ?App;
15-
}
15+
}

src/Apps/ConfigAppProvider.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function findBySecret(string $appSecret): ?App
5353

5454
protected function instanciate(?array $appAttributes): ?App
5555
{
56-
if (!$appAttributes) {
56+
if (! $appAttributes) {
5757
return null;
5858
}
5959

@@ -71,7 +71,6 @@ protected function instanciate(?array $appAttributes): ?App
7171
->enableClientMessages($appAttributes['enable_client_messages'])
7272
->enableStatistics($appAttributes['enable_statistics']);
7373

74-
7574
return $app;
7675
}
77-
}
76+
}

src/Console/CleanStatistics.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
class CleanStatistics extends Command
1010
{
11-
1211
protected $signature = 'websockets:clean
1312
{appId? : (optional) The app id that will be cleaned.}';
1413

@@ -36,4 +35,4 @@ public function handle()
3635

3736
$this->comment('All done!');
3837
}
39-
}
38+
}

src/Console/StartWebSocketServer.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@
22

33
namespace BeyondCode\LaravelWebSockets\Console;
44

5+
use React\Socket\Connector;
6+
use Clue\React\Buzz\Browser;
7+
use Illuminate\Console\Command;
8+
use React\EventLoop\Factory as LoopFactory;
9+
use BeyondCode\LaravelWebSockets\Statistics\DnsResolver;
510
use BeyondCode\LaravelWebSockets\Facades\StatisticsLogger;
611
use BeyondCode\LaravelWebSockets\Facades\WebSocketsRouter;
7-
use BeyondCode\LaravelWebSockets\Server\Logger\ConnectionLogger;
812
use BeyondCode\LaravelWebSockets\Server\Logger\HttpLogger;
13+
use BeyondCode\LaravelWebSockets\Server\WebSocketServerFactory;
14+
use BeyondCode\LaravelWebSockets\Server\Logger\ConnectionLogger;
915
use BeyondCode\LaravelWebSockets\Server\Logger\WebsocketsLogger;
10-
use BeyondCode\LaravelWebSockets\Statistics\DnsResolver;
16+
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
1117
use BeyondCode\LaravelWebSockets\Statistics\Logger\HttpStatisticsLogger;
1218
use BeyondCode\LaravelWebSockets\Statistics\Logger\StatisticsLogger as StatisticsLoggerInterface;
1319

14-
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
15-
use Clue\React\Buzz\Browser;
16-
use Illuminate\Console\Command;
17-
use BeyondCode\LaravelWebSockets\Server\WebSocketServerFactory;
18-
19-
use React\EventLoop\Factory as LoopFactory;
20-
use React\Socket\Connector;
21-
2220
class StartWebSocketServer extends Command
2321
{
2422
protected $signature = 'websockets:serve {--host=0.0.0.0} {--port=6001} ';
@@ -49,16 +47,16 @@ public function handle()
4947
protected function configureStatisticsLogger()
5048
{
5149
$connector = new Connector($this->loop, [
52-
'dns' => new DnsResolver()
50+
'dns' => new DnsResolver(),
5351
]);
5452

5553
$browser = new Browser($this->loop, $connector);
5654

57-
app()->singleton(StatisticsLoggerInterface::class, function() use ($browser) {
55+
app()->singleton(StatisticsLoggerInterface::class, function () use ($browser) {
5856
return new HttpStatisticsLogger(app(ChannelManager::class), $browser);
5957
});
6058

61-
$this->loop->addPeriodicTimer(config('websockets.statistics.interval_in_seconds'), function() {
59+
$this->loop->addPeriodicTimer(config('websockets.statistics.interval_in_seconds'), function () {
6260
StatisticsLogger::save();
6361
});
6462

@@ -67,7 +65,7 @@ protected function configureStatisticsLogger()
6765

6866
protected function configureHttpLogger()
6967
{
70-
app()->singleton(HttpLogger::class, function() {
68+
app()->singleton(HttpLogger::class, function () {
7169
return (new HttpLogger($this->output))
7270
->enable(config('app.debug'))
7371
->verbose($this->output->isVerbose());
@@ -78,7 +76,7 @@ protected function configureHttpLogger()
7876

7977
protected function configureMessageLogger()
8078
{
81-
app()->singleton(WebsocketsLogger::class, function() {
79+
app()->singleton(WebsocketsLogger::class, function () {
8280
return (new WebsocketsLogger($this->output))
8381
->enable(config('app.debug'))
8482
->verbose($this->output->isVerbose());
@@ -89,7 +87,7 @@ protected function configureMessageLogger()
8987

9088
protected function configureConnectionLogger()
9189
{
92-
app()->bind(ConnectionLogger::class, function() {
90+
app()->bind(ConnectionLogger::class, function () {
9391
return (new ConnectionLogger($this->output))
9492
->enable(config('app.debug'))
9593
->verbose($this->output->isVerbose());
@@ -111,7 +109,7 @@ protected function startWebSocketServer()
111109

112110
$routes = WebSocketsRouter::getRoutes();
113111

114-
/** 🛰 Start the server 🛰 */
112+
/* 🛰 Start the server 🛰 */
115113
(new WebSocketServerFactory())
116114
->setLoop($this->loop)
117115
->useRoutes($routes)

src/Dashboard/DashboardLogger.php

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

33
namespace BeyondCode\LaravelWebSockets\Dashboard;
44

5+
use stdClass;
56
use Ratchet\ConnectionInterface;
67
use BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManager;
7-
use stdClass;
88

99
class DashboardLogger
1010
{
@@ -76,7 +76,7 @@ public static function apiMessage($appId, string $channel, string $event, string
7676

7777
public static function log($appId, string $type, array $attributes = [])
7878
{
79-
$channelName = static::LOG_CHANNEL_PREFIX . $type;
79+
$channelName = static::LOG_CHANNEL_PREFIX.$type;
8080

8181
$channel = app(ChannelManager::class)->find($appId, $channelName);
8282

@@ -85,9 +85,8 @@ public static function log($appId, string $type, array $attributes = [])
8585
'channel' => $channelName,
8686
'data' => [
8787
'type' => $type,
88-
'time' => strftime("%H:%M:%S")
88+
'time' => strftime('%H:%M:%S'),
8989
] + $attributes,
9090
]);
9191
}
92-
93-
}
92+
}

src/Dashboard/Http/Controllers/AuthenticateDashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ public function __invoke(Request $request, Broadcaster $broadcaster)
1616
*/
1717
return $broadcaster->validAuthenticationResponse($request, []);
1818
}
19-
}
19+
}

src/Dashboard/Http/Controllers/DashboardApiController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function getStatistics($appId)
1111

1212
$statisticData = $statistics->map(function ($statistic) {
1313
return [
14-
'timestamp' => (string)$statistic->created_at,
14+
'timestamp' => (string) $statistic->created_at,
1515
'peak_connection_count' => $statistic->peak_connection_count,
1616
'websocket_message_count' => $statistic->websocket_message_count,
1717
'api_message_count' => $statistic->api_message_count,
@@ -30,7 +30,7 @@ public function getStatistics($appId)
3030
'api_message_count' => [
3131
'x' => $statisticData->pluck('timestamp'),
3232
'y' => $statisticData->pluck('api_message_count'),
33-
]
33+
],
3434
];
3535
}
36-
}
36+
}

src/Dashboard/Http/Controllers/SendMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers;
44

5-
use BeyondCode\LaravelWebSockets\Statistics\Rules\AppId;
65
use Pusher\Pusher;
76
use Illuminate\Http\Request;
7+
use BeyondCode\LaravelWebSockets\Statistics\Rules\AppId;
88
use Illuminate\Broadcasting\Broadcasters\PusherBroadcaster;
99

1010
class SendMessage

0 commit comments

Comments
 (0)