summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2019-08-16 07:57:34 +0200
committerGitHub <noreply@github.com>2019-08-16 07:57:34 +0200
commitae99d52aad2f8c008ce064d73141fcd3796a3dee (patch)
tree868b9ca7015207539280c7b0c53466f0968b1436 /lib
parent6c01164b9b23ee70544487484c23a1bd196ca3c4 (diff)
Update to feedio 4+ (#494)
- bumped dependencies to last supported version travis: - removed php 7.0 - move main target to nc 16 - drop support for nc 14 & 15 Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/Fetcher/Client/FeedIoClient.php3
-rw-r--r--lib/Fetcher/Client/LegacyGuzzleClient.php3
-rw-r--r--lib/Fetcher/Client/LegacyGuzzleResponse.php12
3 files changed, 10 insertions, 8 deletions
diff --git a/lib/Fetcher/Client/FeedIoClient.php b/lib/Fetcher/Client/FeedIoClient.php
index d9ce8d897..268828e2b 100644
--- a/lib/Fetcher/Client/FeedIoClient.php
+++ b/lib/Fetcher/Client/FeedIoClient.php
@@ -11,6 +11,7 @@
namespace OCA\News\Fetcher\Client;
use FeedIo\Adapter\ClientInterface;
+use FeedIo\Adapter\ResponseInterface;
use FeedIo\Adapter\Guzzle\Response;
use FeedIo\Adapter\NotFoundException;
use FeedIo\Adapter\ServerErrorException;
@@ -41,7 +42,7 @@ class FeedIoClient implements ClientInterface
* @throws \FeedIo\Adapter\ServerErrorException
* @return \FeedIo\Adapter\ResponseInterface
*/
- public function getResponse($url, \DateTime $modifiedSince)
+ public function getResponse(string $url, \DateTime $modifiedSince) : ResponseInterface
{
try {
$options = [
diff --git a/lib/Fetcher/Client/LegacyGuzzleClient.php b/lib/Fetcher/Client/LegacyGuzzleClient.php
index 8e41221c9..4d56df0b3 100644
--- a/lib/Fetcher/Client/LegacyGuzzleClient.php
+++ b/lib/Fetcher/Client/LegacyGuzzleClient.php
@@ -12,6 +12,7 @@
namespace OCA\News\Fetcher\Client;
use FeedIo\Adapter\ClientInterface as FeedIoClientInterface;
+use FeedIo\Adapter\ResponseInterface;
use FeedIo\Adapter\NotFoundException;
use FeedIo\Adapter\ServerErrorException;
use Guzzle\Service\ClientInterface;
@@ -42,7 +43,7 @@ class LegacyGuzzleClient implements FeedIoClientInterface
* @throws \FeedIo\Adapter\ServerErrorException
* @return \FeedIo\Adapter\ResponseInterface
*/
- public function getResponse($url, \DateTime $modifiedSince)
+ public function getResponse(string $url, \DateTime $modifiedSince) : ResponseInterface
{
try {
$options = [
diff --git a/lib/Fetcher/Client/LegacyGuzzleResponse.php b/lib/Fetcher/Client/LegacyGuzzleResponse.php
index 1f3b2ddf1..385ebe7e8 100644
--- a/lib/Fetcher/Client/LegacyGuzzleResponse.php
+++ b/lib/Fetcher/Client/LegacyGuzzleResponse.php
@@ -37,7 +37,7 @@ class LegacyGuzzleResponse implements ResponseInterface
/**
* @return boolean
*/
- public function isModified()
+ public function isModified() : bool
{
return $this->response->getStatusCode() !== 304 && $this->response->getBody()->getSize() > 0;
}
@@ -45,7 +45,7 @@ class LegacyGuzzleResponse implements ResponseInterface
/**
* @return \Psr\Http\Message\StreamInterface
*/
- public function getBody()
+ public function getBody() : ? string
{
return $this->response->getBody();
}
@@ -53,7 +53,7 @@ class LegacyGuzzleResponse implements ResponseInterface
/**
* @return \DateTime|null
*/
- public function getLastModified()
+ public function getLastModified() : ?\DateTime
{
if ($this->response->hasHeader(static::HTTP_LAST_MODIFIED)) {
$lastModified = \DateTime::createFromFormat(
@@ -64,13 +64,13 @@ class LegacyGuzzleResponse implements ResponseInterface
return false === $lastModified ? null : $lastModified;
}
- return;
+ return null;
}
/**
* @return array
*/
- public function getHeaders()
+ public function getHeaders() : iterable
{
return $this->response->getHeaders();
}
@@ -79,7 +79,7 @@ class LegacyGuzzleResponse implements ResponseInterface
* @param string $name
* @return string[]
*/
- public function getHeader($name)
+ public function getHeader(string $name) : iterable
{
return current($this->response->getHeader($name));
}