More codestandards.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
31
src/Notification/Notification.php
Normal file
31
src/Notification/Notification.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user