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

Apply fixes from StyleCI #642

Merged
merged 1 commit into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/websockets.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
*/
'sqlite' => [
'database' => storage_path('laravel-websockets.sqlite'),
]
],

],

Expand Down
4 changes: 2 additions & 2 deletions src/Apps/ConfigAppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ protected function convertIntoApp(?array $appAttributes): ?App
}

$app
->enableClientMessages((bool)$appAttributes['enable_client_messages'])
->enableStatistics((bool)$appAttributes['enable_statistics'])
->enableClientMessages((bool) $appAttributes['enable_client_messages'])
->enableStatistics((bool) $appAttributes['enable_statistics'])
->setCapacity($appAttributes['capacity'] ?? null)
->setAllowedOrigins($appAttributes['allowed_origins'] ?? []);

Expand Down
22 changes: 11 additions & 11 deletions src/Apps/SQLiteAppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
use BeyondCode\LaravelWebSockets\Contracts\AppManager;
use Clue\React\SQLite\DatabaseInterface;
use Clue\React\SQLite\Result;
use React\EventLoop\LoopInterface;
use React\Promise\Deferred;
use React\Promise\PromiseInterface;
use function Clue\React\Block\await;

class SQLiteAppManager implements AppManager
{
Expand Down Expand Up @@ -40,7 +38,7 @@ public function all(): PromiseInterface

$this->database->query('SELECT * FROM `apps`')
->then(function (Result $result) use ($deferred) {
return $deferred->resolve($result->rows);
return $deferred->resolve($result->rows);
});

return $deferred->promise();
Expand Down Expand Up @@ -98,12 +96,14 @@ public function findBySecret($appSecret): PromiseInterface
});

return $deferred->promise();
}/**
* Map the app into an App instance.
*
* @param array|null $app
* @return \BeyondCode\LaravelWebSockets\Apps\App|null
*/
}

/**
* Map the app into an App instance.
*
* @param array|null $app
* @return \BeyondCode\LaravelWebSockets\Apps\App|null
*/
protected function convertIntoApp(?array $appAttributes): ?App
{
if (! $appAttributes) {
Expand All @@ -129,8 +129,8 @@ protected function convertIntoApp(?array $appAttributes): ?App
}

$app
->enableClientMessages((bool)$appAttributes['enable_client_messages'])
->enableStatistics((bool)$appAttributes['enable_statistics'])
->enableClientMessages((bool) $appAttributes['enable_client_messages'])
->enableStatistics((bool) $appAttributes['enable_statistics'])
->setCapacity($appAttributes['capacity'] ?? null)
->setAllowedOrigins(array_filter(explode(',', $appAttributes['allowed_origins'])));

Expand Down
6 changes: 1 addition & 5 deletions src/Console/Commands/StartServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@
use BeyondCode\LaravelWebSockets\Server\Loggers\HttpLogger;
use BeyondCode\LaravelWebSockets\Server\Loggers\WebSocketsLogger;
use BeyondCode\LaravelWebSockets\ServerFactory;
use Clue\React\SQLite\DatabaseInterface;
use Clue\React\SQLite\Factory as SQLiteFactory;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use React\EventLoop\Factory as LoopFactory;
use React\EventLoop\LoopInterface;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;

class StartServer extends Command
{
Expand Down Expand Up @@ -87,7 +83,7 @@ public function getServer()
*/
public function handle()
{
$this->laravel->singleton(LoopInterface::class, function() {
$this->laravel->singleton(LoopInterface::class, function () {
return $this->loop;
});

Expand Down
3 changes: 1 addition & 2 deletions src/Dashboard/Http/Controllers/AuthenticateDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

use BeyondCode\LaravelWebSockets\Apps\App;
use BeyondCode\LaravelWebSockets\Concerns\PushesToPusher;
use function Clue\React\Block\await;
use Illuminate\Broadcasting\Broadcasters\PusherBroadcaster;
use Illuminate\Http\Request;
use React\EventLoop\Factory;
use React\EventLoop\LoopInterface;
use function Clue\React\Block\await;

class AuthenticateDashboard
{
Expand Down
4 changes: 1 addition & 3 deletions src/Dashboard/Http/Controllers/ShowApps.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
namespace BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers;

use BeyondCode\LaravelWebSockets\Contracts\AppManager;
use BeyondCode\LaravelWebSockets\DashboardLogger;
use function Clue\React\Block\await;
use Illuminate\Http\Request;
use React\EventLoop\Factory;
use React\EventLoop\LoopInterface;
use function Clue\React\Block\await;

class ShowApps
{
Expand Down
3 changes: 1 addition & 2 deletions src/Dashboard/Http/Controllers/ShowDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

use BeyondCode\LaravelWebSockets\Contracts\AppManager;
use BeyondCode\LaravelWebSockets\DashboardLogger;
use function Clue\React\Block\await;
use Illuminate\Http\Request;
use React\EventLoop\Factory;
use React\EventLoop\LoopInterface;
use function Clue\React\Block\await;

class ShowDashboard
{
Expand Down
11 changes: 4 additions & 7 deletions src/Dashboard/Http/Controllers/StoreApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

use BeyondCode\LaravelWebSockets\Contracts\AppManager;
use BeyondCode\LaravelWebSockets\Dashboard\Http\Requests\StoreAppRequest;
use BeyondCode\LaravelWebSockets\DashboardLogger;
use Illuminate\Http\Request;
use function Clue\React\Block\await;
use Illuminate\Support\Str;
use React\EventLoop\Factory;
use React\EventLoop\LoopInterface;
use function Clue\React\Block\await;

class StoreApp
{
Expand All @@ -23,9 +20,9 @@ class StoreApp
public function __invoke(StoreAppRequest $request, AppManager $apps)
{
$appData = [
'id' => (string)Str::uuid(),
'key' => (string)Str::uuid(),
'secret' => (string)Str::uuid(),
'id' => (string) Str::uuid(),
'key' => (string) Str::uuid(),
'secret' => (string) Str::uuid(),
'name' => $request->get('name'),
'enable_client_messages' => $request->has('enable_client_messages'),
'enable_statistics' => $request->has('enable_statistics'),
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/AppId.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace BeyondCode\LaravelWebSockets\Rules;

use BeyondCode\LaravelWebSockets\Contracts\AppManager;
use function Clue\React\Block\await;
use Illuminate\Contracts\Validation\Rule;
use React\EventLoop\Factory;
use function Clue\React\Block\await;

class AppId implements Rule
{
Expand Down
2 changes: 1 addition & 1 deletion src/Server/WebSocketHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function onOpen(ConnectionInterface $connection)
}

$this->verifyAppKey($connection)
->then(function() use ($connection) {
->then(function () use ($connection) {
$this->verifyOrigin($connection)
->limitConcurrentConnections($connection)
->generateSocketId($connection)
Expand Down
5 changes: 2 additions & 3 deletions src/WebSocketsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use React\EventLoop\LoopInterface;
use SplFileInfo;
use Symfony\Component\Finder\Finder;
use function Clue\React\Block\await;

class WebSocketsServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -76,7 +75,7 @@ public function register()

protected function registerEventLoop()
{
$this->app->singleton(LoopInterface::class, function() {
$this->app->singleton(LoopInterface::class, function () {
return Factory::create();
});
}
Expand Down Expand Up @@ -105,7 +104,7 @@ protected function registerSQLiteDatabase()
$migrations = (new Finder())
->files()
->ignoreDotFiles(true)
->in(__DIR__ . '/../database/migrations/sqlite')
->in(__DIR__.'/../database/migrations/sqlite')
->name('*.sql');

/** @var SplFileInfo $migration */
Expand Down