- Added noop if no software data were given
This commit is contained in:
parent
2df4ea15e2
commit
bc8d831b6c
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user