*/ private array $providers = []; public function __construct( HolidayProviderInterface ...$providers ) { foreach ( $providers as $provider ) { $this->providers[ $provider->get_id() ] = $provider; } } /** * Get all registered providers. * * @return array */ public function get_providers(): array { return $this->providers; } /** * Look up a provider by ID. * * @param string $id Provider ID. * @return HolidayProviderInterface|null */ public function get_provider( string $id ): ?HolidayProviderInterface { return $this->providers[ $id ] ?? null; } }