More documentation
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

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

50
composer.lock generated

@ -3250,16 +3250,16 @@
},
{
"name": "phpstan/phpdoc-parser",
"version": "1.24.0",
"version": "1.24.1",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6"
"reference": "9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/3510b0a6274cc42f7219367cb3abfc123ffa09d6",
"reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01",
"reference": "9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01",
"shasum": ""
},
"require": {
@ -3291,9 +3291,9 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.0"
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.1"
},
"time": "2023-09-07T20:46:32+00:00"
"time": "2023-09-18T12:18:02+00:00"
},
{
"name": "phpstan/phpstan",
@ -3359,16 +3359,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "10.1.5",
"version": "10.1.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "1df504e42a88044c27a90136910f0b3fe9e91939"
"reference": "56f33548fe522c8d82da7ff3824b42829d324364"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1df504e42a88044c27a90136910f0b3fe9e91939",
"reference": "1df504e42a88044c27a90136910f0b3fe9e91939",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/56f33548fe522c8d82da7ff3824b42829d324364",
"reference": "56f33548fe522c8d82da7ff3824b42829d324364",
"shasum": ""
},
"require": {
@ -3425,7 +3425,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.5"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.6"
},
"funding": [
{
@ -3433,7 +3433,7 @@
"type": "github"
}
],
"time": "2023-09-12T14:37:22+00:00"
"time": "2023-09-19T04:59:03+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -3680,16 +3680,16 @@
},
{
"name": "phpunit/phpunit",
"version": "10.3.4",
"version": "10.3.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "b8d59476f19115c9774b3b447f78131781c6c32b"
"reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b8d59476f19115c9774b3b447f78131781c6c32b",
"reference": "b8d59476f19115c9774b3b447f78131781c6c32b",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/747c3b2038f1139e3dcd9886a3f5a948648b7503",
"reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503",
"shasum": ""
},
"require": {
@ -3713,7 +3713,7 @@
"sebastian/comparator": "^5.0",
"sebastian/diff": "^5.0",
"sebastian/environment": "^6.0",
"sebastian/exporter": "^5.0",
"sebastian/exporter": "^5.1",
"sebastian/global-state": "^6.0.1",
"sebastian/object-enumerator": "^5.0",
"sebastian/recursion-context": "^5.0",
@ -3761,7 +3761,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.4"
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.5"
},
"funding": [
{
@ -3777,7 +3777,7 @@
"type": "tidelift"
}
],
"time": "2023-09-12T14:42:28+00:00"
"time": "2023-09-19T05:42:37+00:00"
},
{
"name": "sebastian/cli-parser",
@ -4214,16 +4214,16 @@
},
{
"name": "sebastian/exporter",
"version": "5.0.1",
"version": "5.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "32ff03d078fed1279c4ec9a407d08c5e9febb480"
"reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/32ff03d078fed1279c4ec9a407d08c5e9febb480",
"reference": "32ff03d078fed1279c4ec9a407d08c5e9febb480",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c3fa8483f9539b190f7cd4bfc4a07631dd1df344",
"reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344",
"shasum": ""
},
"require": {
@ -4280,7 +4280,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"security": "https://github.com/sebastianbergmann/exporter/security/policy",
"source": "https://github.com/sebastianbergmann/exporter/tree/5.0.1"
"source": "https://github.com/sebastianbergmann/exporter/tree/5.1.0"
},
"funding": [
{
@ -4288,7 +4288,7 @@
"type": "github"
}
],
"time": "2023-09-08T04:46:58+00:00"
"time": "2023-09-18T07:15:37+00:00"
},
{
"name": "sebastian/global-state",

@ -50,6 +50,9 @@ class Notification
}
}
/**
* Add a single notifier instance.
*/
public function addNotifier(NotificationInterface $instance): void
{
$this->notifiers[] = $instance;
@ -65,6 +68,11 @@ class Notification
return $this->notifiers;
}
/**
* Push a notification to all notifiers.
*
* Logs an error if sending fails.
*/
public function send(string $title, string $message): void
{
foreach ($this->getNotifiers() as $notifier) {

@ -11,5 +11,8 @@ interface NotificationInterface
*/
public static function factory(array $config): self;
/**
* @throw Exception on error.
*/
public function send(string $title, string $message): void;
}

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