mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 16:08:55 +02:00
Merge pull request #37 from corley/feature/http-endpoint-duplication
Fixes code duplication
This commit is contained in:
@@ -53,23 +53,23 @@ class GuzzleAdapter extends AdapterAbstract implements QueryableInterface
|
||||
|
||||
protected function getHttpSeriesEndpoint()
|
||||
{
|
||||
return sprintf(
|
||||
"%s://%s:%d%s/write",
|
||||
$this->getOptions()->getProtocol(),
|
||||
$this->getOptions()->getHost(),
|
||||
$this->getOptions()->getPort(),
|
||||
$this->getOptions()->getPrefix()
|
||||
);
|
||||
return $this->getHttpEndpoint("write");
|
||||
}
|
||||
|
||||
protected function getHttpQueryEndpoint($name = false)
|
||||
protected function getHttpQueryEndpoint()
|
||||
{
|
||||
return $this->getHttpEndpoint("query");
|
||||
}
|
||||
|
||||
private function getHttpEndpoint($operation)
|
||||
{
|
||||
$url = sprintf(
|
||||
"%s://%s:%d%s/query",
|
||||
"%s://%s:%d%s/%s",
|
||||
$this->getOptions()->getProtocol(),
|
||||
$this->getOptions()->getHost(),
|
||||
$this->getOptions()->getPort(),
|
||||
$this->getOptions()->getPrefix()
|
||||
$this->getOptions()->getPrefix(),
|
||||
$operation
|
||||
);
|
||||
|
||||
return $url;
|
||||
|
||||
Reference in New Issue
Block a user