@ -9,6 +9,9 @@ use Ntfy\Message;
|
||||
use Ntfy\Client;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Send a notification through a ntfy server
|
||||
*/
|
||||
class Ntfy implements NotificationInterface
|
||||
{
|
||||
private string $topic = 'default';
|
||||
@ -16,6 +19,8 @@ class Ntfy implements NotificationInterface
|
||||
/**
|
||||
* Initialize with configuration.
|
||||
*
|
||||
* Factory method.
|
||||
*
|
||||
* @param string[] $config Configuration
|
||||
*/
|
||||
public static function factory(array $config): self
|
||||
@ -34,6 +39,11 @@ class Ntfy implements NotificationInterface
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the topic of the notification message.
|
||||
*
|
||||
* @param string $topic Topic length between 1 and 256 characters.
|
||||
*/
|
||||
public function setTopic(string $topic): void
|
||||
{
|
||||
if (strlen($topic) < 1 || strlen($topic) >= 256) {
|
||||
@ -43,6 +53,9 @@ class Ntfy implements NotificationInterface
|
||||
$this->topic = $topic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the currently set topic.
|
||||
*/
|
||||
public function getTopic(): string
|
||||
{
|
||||
return $this->topic;
|
||||
|
Reference in New Issue
Block a user