diff --git a/src/Backend/AddThis.php b/src/Backend/AddThis.php index be631bd..a719c24 100644 --- a/src/Backend/AddThis.php +++ b/src/Backend/AddThis.php @@ -20,9 +20,10 @@ public function getName() */ public function getRequest($url) { - $url = 'http://api-public.addthis.com/url/shares.json?url='.urlencode($url); - - return $this->createRequest($url); + return new \GuzzleHttp\Psr7\Request( + 'GET', + 'http://api-public.addthis.com/url/shares.json?url='.urlencode($url) + ); } /** diff --git a/src/Backend/Facebook.php b/src/Backend/Facebook.php index 16854c3..9220a47 100644 --- a/src/Backend/Facebook.php +++ b/src/Backend/Facebook.php @@ -30,7 +30,7 @@ public function getRequest($url) .urlencode('SELECT total_count FROM link_stat WHERE url="'.$url.'"'); } - return $this->createRequest($query); + return new \GuzzleHttp\Psr7\Request('GET', $query); } /** diff --git a/src/Backend/Flattr.php b/src/Backend/Flattr.php index b87ad3b..ff3f5e4 100644 --- a/src/Backend/Flattr.php +++ b/src/Backend/Flattr.php @@ -20,9 +20,10 @@ public function getName() */ public function getRequest($url) { - $url = 'https://api.flattr.com/rest/v2/things/lookup/?url='.urlencode($url); - - return $this->createRequest($url); + return new \GuzzleHttp\Psr7\Request( + 'GET', + 'https://api.flattr.com/rest/v2/things/lookup/?url='.urlencode($url) + ); } /** diff --git a/src/Backend/GooglePlus.php b/src/Backend/GooglePlus.php index 2e1bd89..9195792 100644 --- a/src/Backend/GooglePlus.php +++ b/src/Backend/GooglePlus.php @@ -40,7 +40,7 @@ public function getRequest($url) $body = Psr7\stream_for(json_encode($json)); - return $this->createRequest($gPlusUrl, 'POST', ['body' => $body]); + return new \GuzzleHttp\Psr7\Request('POST', $gPlusUrl, [], $body); } /** diff --git a/src/Backend/LinkedIn.php b/src/Backend/LinkedIn.php index dddc966..0e3b097 100644 --- a/src/Backend/LinkedIn.php +++ b/src/Backend/LinkedIn.php @@ -20,9 +20,10 @@ public function getName() */ public function getRequest($url) { - $url = 'https://www.linkedin.com/countserv/count/share?url='.urlencode($url).'&lang=de_DE&format=json'; - - return $this->createRequest($url); + return new \GuzzleHttp\Psr7\Request( + 'GET', + 'https://www.linkedin.com/countserv/count/share?url='.urlencode($url).'&lang=de_DE&format=json' + ); } /** diff --git a/src/Backend/Pinterest.php b/src/Backend/Pinterest.php index eca9c32..767b9c9 100644 --- a/src/Backend/Pinterest.php +++ b/src/Backend/Pinterest.php @@ -20,9 +20,10 @@ public function getName() */ public function getRequest($url) { - $url = 'http://api.pinterest.com/v1/urls/count.json?callback=x&url='.urlencode($url); - - return $this->createRequest($url); + return new \GuzzleHttp\Psr7\Request( + 'GET', + 'http://api.pinterest.com/v1/urls/count.json?callback=x&url='.urlencode($url) + ); } /** diff --git a/src/Backend/Reddit.php b/src/Backend/Reddit.php index 0db0c0e..65e2f7b 100644 --- a/src/Backend/Reddit.php +++ b/src/Backend/Reddit.php @@ -20,7 +20,7 @@ public function getName() */ public function getRequest($url) { - return $this->createRequest('https://www.reddit.com/api/info.json?url='.urlencode($url)); + return new \GuzzleHttp\Psr7\Request('GET', 'https://www.reddit.com/api/info.json?url='.urlencode($url)); } /** diff --git a/src/Backend/Request.php b/src/Backend/Request.php index ca2f2aa..7c2135a 100644 --- a/src/Backend/Request.php +++ b/src/Backend/Request.php @@ -3,7 +3,6 @@ namespace Heise\Shariff\Backend; use GuzzleHttp\ClientInterface; -use Psr\Http\Message\RequestInterface; /** * Class Request. @@ -24,21 +23,6 @@ public function __construct(ClientInterface $client) $this->client = $client; } - /** - * @param string $url - * @param string $method - * @param array $options - * - * @return RequestInterface - */ - protected function createRequest($url, $method = 'GET', $options = []) - { - // $defaults = array('future' => true, 'debug' => true); - $defaults = ['future' => true, 'timeout' => 5.0]; - - return new \GuzzleHttp\Psr7\Request($method, $url, array_merge($defaults, $options)); - } - /** * {@inheritdoc} */ diff --git a/src/Backend/StumbleUpon.php b/src/Backend/StumbleUpon.php index fd89ee9..f415633 100644 --- a/src/Backend/StumbleUpon.php +++ b/src/Backend/StumbleUpon.php @@ -20,7 +20,10 @@ public function getName() */ public function getRequest($url) { - return $this->createRequest('https://www.stumbleupon.com/services/1.01/badge.getinfo?url='.urlencode($url)); + return new \GuzzleHttp\Psr7\Request( + 'GET', + 'https://www.stumbleupon.com/services/1.01/badge.getinfo?url='.urlencode($url) + ); } /** diff --git a/src/Backend/Xing.php b/src/Backend/Xing.php index 06537e7..88136a7 100644 --- a/src/Backend/Xing.php +++ b/src/Backend/Xing.php @@ -20,9 +20,10 @@ public function getName() */ public function getRequest($url) { - $query = 'https://www.xing-share.com/spi/shares/statistics?url='.urlencode($url); - - return $this->createRequest($query, 'POST'); + return new \GuzzleHttp\Psr7\Request( + 'POST', + 'https://www.xing-share.com/spi/shares/statistics?url='.urlencode($url) + ); } /**