diff options
Diffstat (limited to 'lib/Fetcher')
-rw-r--r-- | lib/Fetcher/Client/FeedIoClient.php | 3 | ||||
-rw-r--r-- | lib/Fetcher/Client/LegacyGuzzleClient.php | 3 | ||||
-rw-r--r-- | lib/Fetcher/Client/LegacyGuzzleResponse.php | 12 |
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)); } |