From bc8d831b6cd876db7f385367a796b7ea49238995 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 9 Jun 2026 19:18:21 +0000 Subject: [PATCH] - Added noop if no software data were given --- src/Dump.php | 4 +++- src/Handler.php | 4 +++- src/SoftwareConfig.php | 26 +++++++------------------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/Dump.php b/src/Dump.php index 9271e12..c14089c 100644 --- a/src/Dump.php +++ b/src/Dump.php @@ -35,7 +35,9 @@ namespace Negundo\Client { $this->sent[$dumpHash] = true; - return $this->transport->push($this->config->url('dump/report'), $data); + $url = $this->config->url('dump/report'); + + return $url ? $this->transport->push($url, $data) : false; } } } diff --git a/src/Handler.php b/src/Handler.php index f94af0a..ed36d89 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -68,6 +68,8 @@ abstract class Handler { $data = $this->handleException($ex); - return $this->transport->push($this->config->url('bug/report'), $data); + $url = $this->config->url('bug/report'); + + return $url ? $this->transport->push($url, $data) : false; } } \ No newline at end of file diff --git a/src/SoftwareConfig.php b/src/SoftwareConfig.php index 80d6cc6..cc268f1 100644 --- a/src/SoftwareConfig.php +++ b/src/SoftwareConfig.php @@ -4,29 +4,17 @@ namespace Negundo\Client; class SoftwareConfig { - public string $serverUrl; + public function __construct( + public string $serverUrl, + public string $softwareHash, + ) {} - public string $softwareHash; - - public function __construct(string $softwareHash, string $serverUrl) + public function url(string $path) : string|null { - if (! $softwareHash ) { - throw new \Exception("[Negundo] - You must provide a software hash to match a registered application on the plateform."); - } - else { - $this->softwareHash = $softwareHash; + if (empty($this->serverUrl) || empty($this->softwareHash)) { + return null; } - if (! $serverUrl ) { - throw new \Exception("[Negundo] - You must provide a valid Negundo server url endpoint."); - } - else { - $this->serverUrl = $serverUrl; - } - } - - public function url(string $path) : string - { return sprintf("%s/%s/%s", rtrim($this->serverUrl, '/'), $path, $this->softwareHash); } } \ No newline at end of file