This commit is contained in:
mcndave committed 2023-11-03 20:03:49 -04:00
commit a552a6675e
6 files changed
+16 -10

No files matched your search

+7 -3
View File
@@ -25,7 +25,7 @@ namespace Negundo\Client {
static::$instances[] = $this;
}
public function newReport(string $message, ? string $title = null, ? array $data = []) : ? object
public function newReport(string $message, ? string $title = null, ? array $data = []) : object|null|bool
{
$report = $this->taskHandler->sendReport($message, $title, $data);
@@ -45,9 +45,13 @@ namespace Negundo\Client {
namespace {
if (! function_exists('ntask') ) {
function ntask(string $message, ? string $title = null, ? array $data) {
function ntask(string $message, ? string $title = null, ? array $data = null) {
foreach (\Negundo\Client\Task::$instances as $instance) {
$instance->newReport($message, $title, $data);
$sent = $instance->newReport($message, $title, $data);
if (! $sent ) {
throw new \Exception(sprintf('Could not send report titled `%s`.', $title));
}
}
}
}