More documentation

This commit is contained in:
2023-09-19 06:34:20 +00:00
parent f5a34213b5
commit 876702473c
4 changed files with 49 additions and 25 deletions

@ -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;