Skip to content

Commit 64538ea

Browse files
committed
Rename copyAuthState to copyAuthProperties
1 parent 2314947 commit 64538ea

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/Bootstrappers/BroadcastingConfigBootstrapper.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ public function bootstrap(Tenant $tenant): void
9191
// contract gets the same tenant broadcaster that the manager uses, instead of the stale central one.
9292
// The closure runs immediately (the extended singleton is already resolved), and it's also what makes
9393
// channel auth work in tenant context -- the broadcaster resolved here gets cached as the tenant
94-
// manager's default driver and receives the central broadcaster's auth state (see copyAuthState()).
94+
// manager's default driver and receives the central broadcaster's auth properties (see copyAuthProperties()).
9595
$this->app->extend(BroadcasterContract::class, function (BroadcasterContract $centralBroadcaster) {
9696
$tenantBroadcaster = $this->app->make(BroadcastManager::class)->connection();
9797

98-
$this->copyAuthState($centralBroadcaster, $tenantBroadcaster);
98+
$this->copyAuthProperties($centralBroadcaster, $tenantBroadcaster);
9999

100100
return $tenantBroadcaster;
101101
});
@@ -107,18 +107,19 @@ public function bootstrap(Tenant $tenant): void
107107
}
108108

109109
/**
110-
* Copy the auth state (the channel auth closures, their options, and the authenticated user
111-
* callback) from one broadcaster to another. A freshly resolved broadcaster has no auth state,
112-
* so without the copying, channel auth and user auth would stop working (403) in tenant context.
110+
* Copy the channel and auth properties (the registered channel auth closures, their
111+
* options, and the authenticated user callback) from one broadcaster to another. A
112+
* freshly resolved broadcaster has none of these set, so without the copying, channel
113+
* auth and user auth would stop working (403) in tenant context.
113114
*
114-
* The auth state is stored on the abstract Broadcaster class, not in the Broadcaster
115-
* contract, and it's stored in protected properties. Because of that, we have
115+
* These properties are stored on the abstract Broadcaster class, not in the Broadcaster
116+
* contract, and they're stored in protected properties. Because of that, we have
116117
* to check that both broadcasters are instances of the abstract Broadcaster class and
117118
* use invade() to access the protected properties (for the $channels property, there
118119
* is a public accessor -- getChannels() -- but since invade is already used here,
119120
* we access the property directly for consistency).
120121
*/
121-
protected function copyAuthState(BroadcasterContract $from, BroadcasterContract $to): void
122+
protected function copyAuthProperties(BroadcasterContract $from, BroadcasterContract $to): void
122123
{
123124
if (! $from instanceof Broadcaster || ! $to instanceof Broadcaster) {
124125
return;

tests/Bootstrappers/BroadcastingConfigBootstrapperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
expect(array_keys(invade(app(BroadcastManager::class))->customCreators))->toEqualCanonicalizing($originalDrivers);
226226
});
227227

228-
test('tenant broadcasters receive the auth state of the broadcaster bound in central context', function () {
228+
test('tenant broadcasters receive the auth properties of the broadcaster bound in central context', function () {
229229
config([
230230
'tenancy.bootstrappers' => [BroadcastingConfigBootstrapper::class],
231231
'broadcasting.default' => 'testing',

0 commit comments

Comments
 (0)