More codestandards.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-06-12 09:30:10 +00:00
parent d0270b00ca
commit 0f3bbf1f47
8 changed files with 124 additions and 42 deletions

View File

@ -0,0 +1,31 @@
<?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);
}
}
}