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:
32
src/Notification/Ntfy.php
Normal file
32
src/Notification/Ntfy.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notification;
|
||||
|
||||
use Ntfy\Server;
|
||||
use Ntfy\Message;
|
||||
use Ntfy\Client;
|
||||
|
||||
class Ntfy implements NotificationInterface
|
||||
{
|
||||
private array $config;
|
||||
|
||||
private \Ntfy\Server $server;
|
||||
private \Ntfy\Client $client;
|
||||
|
||||
public function __construct(array $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
|
||||
$this->server = new Server($config['domain']);
|
||||
$this->client = new Client($this->server);
|
||||
}
|
||||
|
||||
public function send(string $title, string $message): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msg->topic($this->config['topic']);
|
||||
$msg->title($title);
|
||||
$msg->body($message);
|
||||
$this->client->send($msg);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user