$providers */ public function __construct( #[AutowireIterator('app.provider')] private readonly iterable $providers, ) {} /** * Probes every configured provider and aggregates the results for the /health endpoint. * * @return array{status: string, providers: array>} 'status' is * "degraded" if any provider's probe() reported an error, otherwise "ok" */ public function check(): array { $statuses = []; $hasError = false; /** @var ProviderInterface $provider */ foreach ($this->providers as $provider) { $status = $provider->probe(); $statuses[$status->name] = $status->toArray(); if ($status->status === ProviderStatusType::Error) { $hasError = true; } } return [ 'status' => $hasError ? 'degraded' : 'ok', 'providers' => $statuses, ]; } }