Apply fixes from StyleCI (#518)

This commit is contained in:
rennokki 2020-09-10 22:59:49 +03:00 committed by GitHub
parent 6f32b89459
commit 341eb9604f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 55 additions and 79 deletions

View File

@ -2,8 +2,9 @@
namespace BeyondCode\LaravelWebSockets\API;
use BeyondCode\LaravelWebSockets\Apps\App;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Server\QueryParameters;
use Ratchet\Http\HttpServerInterface;
use Exception;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Psr7\ServerRequest;
@ -14,11 +15,10 @@ use Illuminate\Support\Collection;
use Psr\Http\Message\RequestInterface;
use Pusher\Pusher;
use Ratchet\ConnectionInterface;
use Ratchet\Http\HttpServerInterface;
use React\Promise\PromiseInterface;
use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
use Symfony\Component\HttpKernel\Exception\HttpException;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Apps\App;
abstract class Controller implements HttpServerInterface
{

View File

@ -2,8 +2,8 @@
namespace BeyondCode\LaravelWebSockets\API;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Symfony\Component\HttpKernel\Exception\HttpException;
class FetchChannel extends Controller

View File

@ -4,7 +4,6 @@ namespace BeyondCode\LaravelWebSockets\API;
use BeyondCode\LaravelWebSockets\Channels\Channel;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use stdClass;
use Symfony\Component\HttpKernel\Exception\HttpException;

View File

@ -2,10 +2,8 @@
namespace BeyondCode\LaravelWebSockets\API;
use BeyondCode\LaravelWebSockets\WebSockets\Channels\PresenceChannel;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Illuminate\Support\Collection;
use Symfony\Component\HttpKernel\Exception\HttpException;
class FetchUsers extends Controller

View File

@ -3,12 +3,8 @@
namespace BeyondCode\LaravelWebSockets\API;
use BeyondCode\LaravelWebSockets\DashboardLogger;
use BeyondCode\LaravelWebSockets\WebSockets\Channels\PresenceChannel;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Illuminate\Support\Collection;
use Symfony\Component\HttpKernel\Exception\HttpException;
use BeyondCode\LaravelWebSockets\Facades\StatisticsCollector;
use Illuminate\Http\Request;
class TriggerEvent extends Controller
{

View File

@ -2,16 +2,16 @@
namespace BeyondCode\LaravelWebSockets\ChannelManagers;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use Illuminate\Support\Str;
use BeyondCode\LaravelWebSockets\Channels\Channel;
use BeyondCode\LaravelWebSockets\Channels\PresenceChannel;
use BeyondCode\LaravelWebSockets\Channels\PrivateChannel;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use Illuminate\Support\Str;
use Ratchet\ConnectionInterface;
use React\EventLoop\LoopInterface;
use React\Promise\FulfilledPromise;
use React\Promise\PromiseInterface;
use stdClass;
use Ratchet\ConnectionInterface;
use React\EventLoop\LoopInterface;
class LocalChannelManager implements ChannelManager
{

View File

@ -2,18 +2,14 @@
namespace BeyondCode\LaravelWebSockets\ChannelManagers;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use Illuminate\Support\Str;
use BeyondCode\LaravelWebSockets\Channels\Channel;
use BeyondCode\LaravelWebSockets\Channels\PresenceChannel;
use BeyondCode\LaravelWebSockets\Channels\PrivateChannel;
use React\Promise\FulfilledPromise;
use React\Promise\PromiseInterface;
use Clue\React\Redis\Client;
use Clue\React\Redis\Factory;
use stdClass;
use Illuminate\Support\Str;
use Ratchet\ConnectionInterface;
use React\EventLoop\LoopInterface;
use React\Promise\PromiseInterface;
use stdClass;
class RedisChannelManager extends LocalChannelManager
{

View File

@ -2,12 +2,12 @@
namespace BeyondCode\LaravelWebSockets\Channels;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\DashboardLogger;
use BeyondCode\LaravelWebSockets\Server\Exceptions\InvalidSignature;
use Illuminate\Support\Str;
use Ratchet\ConnectionInterface;
use stdClass;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use Illuminate\Support\Str;
use BeyondCode\LaravelWebSockets\Server\Exceptions\InvalidSignature;
class Channel
{

View File

@ -2,17 +2,17 @@
namespace BeyondCode\LaravelWebSockets\Console\Commands;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Contracts\StatisticsCollector;
use BeyondCode\LaravelWebSockets\Facades\StatisticsCollector as StatisticsCollectorFacade;
use BeyondCode\LaravelWebSockets\Facades\WebSocketsRouter;
use BeyondCode\LaravelWebSockets\Server\Loggers\ConnectionLogger;
use BeyondCode\LaravelWebSockets\Server\Loggers\HttpLogger;
use BeyondCode\LaravelWebSockets\Server\Loggers\WebSocketsLogger;
use BeyondCode\LaravelWebSockets\ServerFactory;
use Illuminate\Console\Command;
use BeyondCode\LaravelWebSockets\Facades\WebSocketsRouter;
use BeyondCode\LaravelWebSockets\Facades\StatisticsCollector as StatisticsCollectorFacade;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Contracts\StatisticsCollector;
use React\EventLoop\Factory as LoopFactory;
use Illuminate\Support\Facades\Cache;
use React\EventLoop\Factory as LoopFactory;
class StartServer extends Command
{

View File

@ -3,9 +3,9 @@
namespace BeyondCode\LaravelWebSockets\Contracts;
use Ratchet\ConnectionInterface;
use React\EventLoop\LoopInterface;
use React\Promise\PromiseInterface;
use stdClass;
use React\EventLoop\LoopInterface;
interface ChannelManager
{

View File

@ -2,7 +2,6 @@
namespace BeyondCode\LaravelWebSockets\Contracts;
use React\Promise\FulfilledPromise;
use React\Promise\PromiseInterface;
interface StatisticsCollector

View File

@ -4,7 +4,6 @@ namespace BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Rules\AppId;
use Exception;
use Illuminate\Http\Request;
class SendMessage

View File

@ -12,7 +12,6 @@ class DashboardLogger
const TYPE_CONNECTED = 'connected';
const TYPE_OCCUPIED = 'occupied';
const TYPE_SUBSCRIBED = 'subscribed';

View File

@ -2,8 +2,8 @@
namespace BeyondCode\LaravelWebSockets\Facades;
use Illuminate\Support\Facades\Facade;
use BeyondCode\LaravelWebSockets\Contracts\StatisticsCollector as StatisticsCollectorInterface;
use Illuminate\Support\Facades\Facade;
class StatisticsCollector extends Facade
{

View File

@ -2,8 +2,8 @@
namespace BeyondCode\LaravelWebSockets\Facades;
use Illuminate\Support\Facades\Facade;
use BeyondCode\LaravelWebSockets\Contracts\StatisticsStore as StatisticsStoreInterface;
use Illuminate\Support\Facades\Facade;
class StatisticsStore extends Facade
{

View File

@ -12,6 +12,6 @@ class ConnectionsOverCapacity extends WebSocketException
*/
public function __construct()
{
$this->trigger("Over capacity", 4100);
$this->trigger('Over capacity', 4100);
}
}

View File

@ -12,6 +12,6 @@ class InvalidSignature extends WebSocketException
*/
public function __construct()
{
$this->trigger("Invalid Signature", 4009);
$this->trigger('Invalid Signature', 4009);
}
}

View File

@ -2,8 +2,8 @@
namespace BeyondCode\LaravelWebSockets\Server;
use Ratchet\Http\HttpServerInterface;
use Ratchet\Http\HttpServer as BaseHttpServer;
use Ratchet\Http\HttpServerInterface;
class HttpServer extends BaseHttpServer
{

View File

@ -2,11 +2,9 @@
namespace BeyondCode\LaravelWebSockets\Server\Messages;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use Illuminate\Support\Str;
use Ratchet\ConnectionInterface;
use stdClass;
use BeyondCode\LaravelWebSockets\Contracts\PusherMessage;
class PusherChannelProtocolMessage extends PusherClientMessage
{

View File

@ -2,12 +2,12 @@
namespace BeyondCode\LaravelWebSockets\Server\Messages;
use BeyondCode\LaravelWebSockets\DashboardLogger;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Contracts\PusherMessage;
use BeyondCode\LaravelWebSockets\DashboardLogger;
use Illuminate\Support\Str;
use Ratchet\ConnectionInterface;
use stdClass;
use BeyondCode\LaravelWebSockets\Contracts\PusherMessage;
class PusherClientMessage implements PusherMessage
{
@ -75,6 +75,5 @@ class PusherClientMessage implements PusherMessage
'event' => $this->payload->event,
'data' => $this->payload,
]);
}
}

View File

@ -2,11 +2,11 @@
namespace BeyondCode\LaravelWebSockets\Server\Messages;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Contracts\PusherMessage;
use Illuminate\Support\Str;
use Ratchet\ConnectionInterface;
use Ratchet\RFC6455\Messaging\MessageInterface;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Contracts\PusherMessage;
class PusherMessageFactory
{

View File

@ -3,7 +3,6 @@
namespace BeyondCode\LaravelWebSockets\Server;
use BeyondCode\LaravelWebSockets\Server\Loggers\WebSocketsLogger;
use Illuminate\Support\Collection;
use Ratchet\WebSocket\MessageComponentInterface;
use Ratchet\WebSocket\WsServer;
use Symfony\Component\Routing\Route;

View File

@ -2,14 +2,14 @@
namespace BeyondCode\LaravelWebSockets\Server;
use BeyondCode\LaravelWebSockets\DashboardLogger;
use BeyondCode\LaravelWebSockets\Apps\App;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\DashboardLogger;
use BeyondCode\LaravelWebSockets\Facades\StatisticsCollector;
use Exception;
use Ratchet\WebSocket\MessageComponentInterface;
use Ratchet\ConnectionInterface;
use Ratchet\RFC6455\Messaging\MessageInterface;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Facades\StatisticsCollector;
use Ratchet\WebSocket\MessageComponentInterface;
class WebSocketHandler implements MessageComponentInterface
{

View File

@ -2,6 +2,8 @@
namespace BeyondCode\LaravelWebSockets;
use BeyondCode\LaravelWebSockets\Server\HttpServer;
use BeyondCode\LaravelWebSockets\Server\Loggers\HttpLogger;
use Ratchet\Http\Router;
use Ratchet\Server\IoServer;
use React\EventLoop\Factory as LoopFactory;
@ -12,8 +14,6 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
use BeyondCode\LaravelWebSockets\Server\HttpServer;
use BeyondCode\LaravelWebSockets\Server\Loggers\HttpLogger;
class ServerFactory
{

View File

@ -2,12 +2,12 @@
namespace BeyondCode\LaravelWebSockets\Statistics\Collectors;
use React\Promise\FulfilledPromise;
use React\Promise\PromiseInterface;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Contracts\StatisticsCollector;
use BeyondCode\LaravelWebSockets\Facades\StatisticsStore;
use BeyondCode\LaravelWebSockets\Statistics\Statistic;
use BeyondCode\LaravelWebSockets\Contracts\StatisticsCollector;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use React\Promise\FulfilledPromise;
use React\Promise\PromiseInterface;
class MemoryCollector implements StatisticsCollector
{

View File

@ -2,14 +2,10 @@
namespace BeyondCode\LaravelWebSockets\Statistics\Collectors;
use React\Promise\FulfilledPromise;
use React\Promise\PromiseInterface;
use BeyondCode\LaravelWebSockets\Facades\StatisticsStore;
use BeyondCode\LaravelWebSockets\Statistics\Statistic;
use BeyondCode\LaravelWebSockets\Contracts\StatisticsCollector;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use Illuminate\Cache\RedisLock;
use Illuminate\Support\Facades\Redis;
use React\Promise\PromiseInterface;
class RedisCollector extends MemoryCollector
{

View File

@ -2,15 +2,15 @@
namespace BeyondCode\LaravelWebSockets;
use Illuminate\Support\ServiceProvider;
use BeyondCode\LaravelWebSockets\Server\Router;
use BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize as AuthorizeDashboard;
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\AuthenticateDashboard;
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\SendMessage;
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\ShowDashboard;
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\ShowStatistics;
use BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize as AuthorizeDashboard;
use BeyondCode\LaravelWebSockets\Server\Router;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
class WebSocketsServiceProvider extends ServiceProvider
{

View File

@ -2,8 +2,6 @@
namespace BeyondCode\LaravelWebSockets\Test;
use BeyondCode\LaravelWebSockets\Test\TestCase;
class StatisticsCleanTest extends TestCase
{
public function test_clean_statistics_for_app_id()
@ -17,7 +15,7 @@ class StatisticsCleanTest extends TestCase
foreach ($this->statisticsStore->getRawRecords() as $record) {
$record->update(['created_at' => now()->subDays(10)]);
};
}
$this->artisan('websockets:clean', [
'appId' => '12345',
@ -38,7 +36,7 @@ class StatisticsCleanTest extends TestCase
foreach ($this->statisticsStore->getRawRecords() as $record) {
$record->update(['created_at' => now()->subDays(10)]);
};
}
$this->artisan('websockets:clean', ['--days' => 1]);

View File

@ -2,7 +2,8 @@
namespace BeyondCode\LaravelWebSockets\Test;
use BeyondCode\LaravelWebSockets\Server\Exceptions\{ OriginNotAllowed, UnknownAppKey, ConnectionsOverCapacity };
use BeyondCode\LaravelWebSockets\Server\Exceptions\OriginNotAllowed;
use BeyondCode\LaravelWebSockets\Server\Exceptions\UnknownAppKey;
class ConnectionTest extends TestCase
{

View File

@ -2,7 +2,6 @@
namespace BeyondCode\LaravelWebSockets\Test\Dashboard;
use BeyondCode\LaravelWebSockets\Statistics\Logger\MemoryStatisticsLogger;
use BeyondCode\LaravelWebSockets\Test\Models\User;
use BeyondCode\LaravelWebSockets\Test\TestCase;

View File

@ -3,8 +3,8 @@
namespace BeyondCode\LaravelWebSockets\Test\Mocks;
use Clue\React\Block;
use React\Promise\PromiseInterface;
use React\Promise\FulfilledPromise;
use React\Promise\PromiseInterface;
class PromiseResolver implements PromiseInterface
{

View File

@ -2,13 +2,13 @@
namespace BeyondCode\LaravelWebSockets\Test;
use Orchestra\Testbench\BrowserKit\TestCase as Orchestra;
use React\EventLoop\Factory as LoopFactory;
use GuzzleHttp\Psr7\Request;
use BeyondCode\LaravelWebSockets\Contracts\ChannelManager;
use BeyondCode\LaravelWebSockets\Contracts\StatisticsCollector;
use BeyondCode\LaravelWebSockets\Contracts\StatisticsStore;
use GuzzleHttp\Psr7\Request;
use Illuminate\Support\Facades\Redis;
use Orchestra\Testbench\BrowserKit\TestCase as Orchestra;
use React\EventLoop\Factory as LoopFactory;
abstract class TestCase extends Orchestra
{