renaming clients to apps
This commit is contained in:
parent
e90e86798c
commit
69acbb704a
|
|
@ -7,17 +7,17 @@ use Illuminate\Support\Collection;
|
||||||
class ConfigAppProvider implements AppProvider
|
class ConfigAppProvider implements AppProvider
|
||||||
{
|
{
|
||||||
/** @var Collection */
|
/** @var Collection */
|
||||||
protected $clients;
|
protected $apps;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->clients = collect(config('websockets.clients'));
|
$this->apps = collect(config('websockets.clients'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return array[\BeyondCode\LaravelWebSockets\ClientProviders\Client] */
|
/** @return array[\BeyondCode\LaravelWebSockets\ClientProviders\Client] */
|
||||||
public function all(): array
|
public function all(): array
|
||||||
{
|
{
|
||||||
return $this->clients
|
return $this->apps
|
||||||
->map(function ($client) {
|
->map(function ($client) {
|
||||||
return $this->instanciate($client);
|
return $this->instanciate($client);
|
||||||
})
|
})
|
||||||
|
|
@ -27,7 +27,7 @@ class ConfigAppProvider implements AppProvider
|
||||||
public function findById(int $appId): ?App
|
public function findById(int $appId): ?App
|
||||||
{
|
{
|
||||||
$clientAttributes = $this
|
$clientAttributes = $this
|
||||||
->clients
|
->apps
|
||||||
->firstWhere('id', $appId);
|
->firstWhere('id', $appId);
|
||||||
|
|
||||||
return $this->instanciate($clientAttributes);
|
return $this->instanciate($clientAttributes);
|
||||||
|
|
@ -36,23 +36,23 @@ class ConfigAppProvider implements AppProvider
|
||||||
public function findByKey(string $appKey): ?App
|
public function findByKey(string $appKey): ?App
|
||||||
{
|
{
|
||||||
$clientAttributes = $this
|
$clientAttributes = $this
|
||||||
->clients
|
->apps
|
||||||
->firstWhere('key', $appKey);
|
->firstWhere('key', $appKey);
|
||||||
|
|
||||||
return $this->instanciate($clientAttributes);
|
return $this->instanciate($clientAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function instanciate(?array $clientAttributes): ?App
|
protected function instanciate(?array $appAttributes): ?App
|
||||||
{
|
{
|
||||||
if (! $clientAttributes) {
|
if (! $appAttributes) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new App(
|
return new App(
|
||||||
$clientAttributes['id'],
|
$appAttributes['id'],
|
||||||
$clientAttributes['key'],
|
$appAttributes['key'],
|
||||||
$clientAttributes['secret'],
|
$appAttributes['secret'],
|
||||||
$clientAttributes['name'] ?? null
|
$appAttributes['name'] ?? null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,7 +12,6 @@ use Ratchet\ConnectionInterface;
|
||||||
|
|
||||||
abstract class TestCase extends \Orchestra\Testbench\TestCase
|
abstract class TestCase extends \Orchestra\Testbench\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var \BeyondCode\LaravelWebSockets\WebSockets\WebSocketHandler */
|
/** @var \BeyondCode\LaravelWebSockets\WebSockets\WebSocketHandler */
|
||||||
protected $pusherServer;
|
protected $pusherServer;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue