Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 19, 2024
1 parent 5cfc1f7 commit d8e7ac0
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Contracts/ServerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ public function shouldNotPublishEvents(): bool
*/
public function doesNotSubscribeToEvents(): bool
{
return $this->shouldNotPublishEvents();
return ! $this->subscribesToEvents();
}
}
4 changes: 2 additions & 2 deletions src/Protocols/Pusher/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Laravel\Reverb\Contracts\Connection;
use Laravel\Reverb\Protocols\Pusher\Contracts\ChannelManager;
use Laravel\Reverb\Servers\Reverb\Contracts\PubSubProvider;
use Laravel\Reverb\ServerServiceProviderManager;
use Laravel\Reverb\ServerProviderManager;

class EventDispatcher
{
Expand All @@ -16,7 +16,7 @@ class EventDispatcher
*/
public static function dispatch(Application $app, array $payload, ?Connection $connection = null): void
{
$server = app(ServerServiceProviderManager::class);
$server = app(ServerProviderManager::class);

if ($server->shouldNotPublishEvents()) {
static::dispatchSynchronously($app, $payload, $connection);
Expand Down
6 changes: 3 additions & 3 deletions src/ReverbServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public function register(): void

$this->app->instance(Logger::class, new NullLogger);

$this->app->singleton(ServerServiceProviderManager::class);
$this->app->singleton(ServerProviderManager::class);

$this->app->make(ServerServiceProviderManager::class)->register();
$this->app->make(ServerProviderManager::class)->register();
}

/**
Expand All @@ -35,6 +35,6 @@ public function boot(): void
], ['reverb', 'reverb-config']);
}

$this->app->make(ServerServiceProviderManager::class)->boot();
$this->app->make(ServerProviderManager::class)->boot();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\Manager;
use Laravel\Reverb\Servers\Reverb\ReverbServiceProvider;
use Laravel\Reverb\Servers\Reverb\ReverbServerProvider;

class ServerServiceProviderManager extends Manager
class ServerProviderManager extends Manager
{
/**
* Create a new server manager instance.
Expand All @@ -19,9 +19,9 @@ public function __construct(protected Application $app)
/**
* Creates the Reverb driver.
*/
public function createReverbDriver(): ReverbServiceProvider
public function createReverbDriver(): ReverbServerProvider
{
return new ReverbServiceProvider(
return new ReverbServerProvider(
$this->app,
$this->config->get('reverb.servers.reverb', [])
);
Expand Down
3 changes: 2 additions & 1 deletion src/Servers/Reverb/Console/Commands/StartServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Laravel\Reverb\Loggers\CliLogger;
use Laravel\Reverb\Protocols\Pusher\Channels\ChannelConnection;
use Laravel\Reverb\Protocols\Pusher\Contracts\ChannelManager;
use Laravel\Reverb\ServerProviderManager;
use Laravel\Reverb\Servers\Reverb\Contracts\PubSubProvider;
use Laravel\Reverb\Servers\Reverb\Factory as ServerFactory;
use Laravel\Reverb\Servers\Reverb\Http\Server;
Expand Down Expand Up @@ -55,7 +56,7 @@ public function handle(): void

$server = ServerFactory::make($host, $port, loop: $loop);

if ($this->laravel->make(ServerServiceProviderManager::class)->subscribesToEvents()) {
if ($this->laravel->make(ServerProviderManager::class)->subscribesToEvents()) {
$this->laravel->make(PubSubProvider::class)->connect($loop);
$this->laravel->make(PubSubProvider::class)->subscribe();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Laravel\Reverb\Servers\Reverb\Publishing\RedisClientFactory;
use Laravel\Reverb\Servers\Reverb\Publishing\RedisPubSubProvider;

class ReverbServiceProvider extends ServerProvider
class ReverbServerProvider extends ServerProvider
{
/**
* Indicates whether the Reverb server should publish events.
Expand Down
4 changes: 2 additions & 2 deletions tests/ReverbTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Support\Str;
use Laravel\Reverb\Servers\Reverb\Contracts\PubSubProvider;
use Laravel\Reverb\Servers\Reverb\Factory;
use Laravel\Reverb\ServerServiceProviderManager;
use Laravel\Reverb\ServerProviderManager;
use Ratchet\Client\WebSocket;
use React\Async\SimpleFiber;
use React\EventLoop\Loop;
Expand Down Expand Up @@ -73,7 +73,7 @@ protected function defineEnvironment($app): void
*/
public function usingRedis(): void
{
app(ServerServiceProviderManager::class)->withPublishing();
app(ServerProviderManager::class)->withPublishing();

app(PubSubProvider::class)->connect($this->loop);
app(PubSubProvider::class)->subscribe();
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
use Laravel\Reverb\Protocols\Pusher\Contracts\ChannelConnectionManager;
use Laravel\Reverb\Protocols\Pusher\EventDispatcher;
use Laravel\Reverb\Servers\Reverb\Contracts\PubSubProvider;
use Laravel\Reverb\ServerServiceProviderManager;
use Laravel\Reverb\ServerProviderManager;

it('can publish an event when enabled', function () {
$app = app(ApplicationProvider::class)->findByKey('pusher-key');
app(ServerServiceProviderManager::class)->withPublishing();
app(ServerProviderManager::class)->withPublishing();
$pubSub = Mockery::mock(PubSubProvider::class);
$pubSub->shouldReceive('publish')->once()
->with(['application' => serialize($app), 'payload' => ['channel' => 'test-channel']]);
Expand Down

0 comments on commit d8e7ac0

Please sign in to comment.