providers[$provider->getId()] = $provider; } /** * Get a provider by its ID. * * @param string $id * @return FormProviderInterface|null */ public function get(string $id): ?FormProviderInterface { return $this->providers[$id] ?? null; } /** * Get all registered providers. * * @return FormProviderInterface[] */ public function getAll(): array { return $this->providers; } /** * Get only the available (active) providers. * * @return FormProviderInterface[] */ public function getAvailable(): array { return array_filter($this->providers, function (FormProviderInterface $provider) { return $provider->isAvailable(); }); } }