Files
backupscript/src/Notification/Notification.php

32 lines
686 B
PHP
Raw Normal View History

2023-06-12 09:30:10 +00:00
<?php
namespace App\Notification;
class Notification
{
/**
* @type NotificationInterface[] $notifiers
*/
public array $notifiers = array();
public function loadMany(array $config): void
{
foreach ($config as $key => $conf) {
$this->loadSingle($key, $conf);
}
}
public function loadSingle(string $key, array $config): void
{
$class = "\App\Notification\\" . $key;
$this->notifiers[$key] = new $class($config);
}
public function send(string $title, string $message): void
{
foreach ($this->notifiers as $notifier) {
$notifier->send($title, $message);
}
}
}