$config Array of notifier configurations. */ public function loadMany(array $config): void { foreach ($config as $conf) { $this->loadSingle($conf['type'], $conf); } } /** * Load a single configuration * * @param string $key Notification class * @param string[] $config Implementation specific configuration * @SuppressWarnings(PHPMD) */ public function loadSingle(string $key, array $config): void { switch ($key) { case 'ntfy': case 'Ntfy': case 'NTFY': $this->addNotifier(Ntfy::factory($config)); break; default: break; } } public function addNotifier(NotificationInterface $instance): void { $this->notifiers[] = $instance; } /** * Get all active notifiers. * * @return NotificationInterface[] All notifiers. */ public function getNotifiers(): array { return $this->notifiers; } public function send(string $title, string $message): void { foreach ($this->getNotifiers() as $notifier) { try { $notifier->send($title, $message); } catch (\Exception $e) { $this->logger->error($e->getMessage()); } } } }