This commit is contained in:
freek 2018-11-26 00:29:35 +01:00
parent 74e78f4a19
commit ad2e5560e3
3 changed files with 14 additions and 15 deletions

View File

@ -51,8 +51,4 @@ class Client
$this->name = $name; $this->name = $name;
} }
} }

View File

@ -5,9 +5,10 @@ namespace BeyondCode\LaravelWebSockets\ClientProviders;
interface ClientProvider interface ClientProvider
{ {
/** @return array[BeyondCode\LaravelWebSockets\ClientProviders\Client] */
public function all(): array;
public function findByAppId(int $appId): ?Client; public function findByAppId(int $appId): ?Client;
public function findByAppKey(string $appKey): ?Client; public function findByAppKey(string $appKey): ?Client;
public function all(): array;
} }

View File

@ -6,6 +6,15 @@ use Illuminate\Support\Collection;
class ConfigClientProvider implements ClientProvider class ConfigClientProvider implements ClientProvider
{ {
/** @return array[BeyondCode\LaravelWebSockets\ClientProviders\Client] */
public function all(): array
{
return $this->allClients()
->map(function ($client) {
return $this->instanciate($client);
})
->toArray();
}
public function findByAppId(int $appId): ?Client public function findByAppId(int $appId): ?Client
{ {
$clientAttributes = $this $clientAttributes = $this
@ -24,14 +33,7 @@ class ConfigClientProvider implements ClientProvider
return $this->instanciate($clientAttributes); return $this->instanciate($clientAttributes);
} }
public function all(): array
{
return $this->allClients()
->map(function ($client) {
return $this->instanciate($client);
})
->toArray();
}
protected function allClients(): Collection protected function allClients(): Collection
{ {