From ffe45967c1839dd95a4757975a1e6872a9d92383 Mon Sep 17 00:00:00 2001 From: Walter Dal Mut Date: Wed, 24 Jun 2015 10:01:20 +0200 Subject: [PATCH] Fixes code duplication The HTTP endpoint generation is effectively duplicated --- src/Adapter/GuzzleAdapter.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Adapter/GuzzleAdapter.php b/src/Adapter/GuzzleAdapter.php index 35a3a6db4..cb5b9f4be 100644 --- a/src/Adapter/GuzzleAdapter.php +++ b/src/Adapter/GuzzleAdapter.php @@ -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;