providers = []; foreach ($providers as $provider) { $this->providers[$provider->getId()] = $provider; } $this->providerMissing = $providerMissing; } /** * @param string $providerId * @return IProvider|null */ public function getProvider(string $providerId) { return $this->providers[$providerId] ?? null; } /** * @return IProvider[] */ public function getProviders(): array { return $this->providers; } /** * @return IProvider[] */ public function getPrimaryProviders(): array { return array_filter($this->providers, function (IProvider $provider) { return !($provider instanceof BackupCodesProvider); }); } public function isProviderMissing(): bool { return $this->providerMissing; } }