Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Vidulich <ben@vidulich.nz>
  • Loading branch information
zl4bv committed Aug 8, 2024
1 parent 5525e95 commit 36f3010
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/Fetcher/FeedFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,20 @@ public function fetch(
$url = $url2->getNormalizedURL();
$resource = $this->reader->read($url, null, $lastModified);

if ($resource->getResponse()->getLastModified() instanceof DateTime) {
$lastModified = $resource->getResponse()->getLastModified();
}

$location = $resource->getUrl();
$parsedFeed = $resource->getFeed();
$feed = $this->buildFeed(
$parsedFeed,
$url,
$location,
$lastModified
$location
);

if (!is_null($resource->getResponse()->getLastModified())) {
$feed->setHttpLastModified($resource->getResponse()->getLastModified()->format(DateTime::RSS));
} elseif(!is_null($lastModified)) {
$feed->setHttpLastModified($lastModified->format(DateTime::RSS));
}

$items = [];
$RTL = $this->determineRtl($parsedFeed);
$feedName = $parsedFeed->getTitle();
Expand Down Expand Up @@ -490,7 +491,7 @@ protected function getFavicon(FeedInterface $feed, string $url): ?string
*
* @return Feed
*/
protected function buildFeed(FeedInterface $feed, string $url, string $location, ?DateTime $httpLastModified): Feed
protected function buildFeed(FeedInterface $feed, string $url, string $location): Feed
{
$newFeed = new Feed();

Expand All @@ -502,8 +503,8 @@ protected function buildFeed(FeedInterface $feed, string $url, string $location,
$newFeed->setUrl($url); // the url used to add the feed
$newFeed->setLocation($location); // the url where the feed was found
$newFeed->setLink($feed->getLink()); // <link> attribute in the feed
if ($httpLastModified instanceof DateTime) {
$newFeed->setHttpLastModified($httpLastModified->format(DateTime::RSS));
if ($feed->getLastModified() instanceof DateTime) {
$newFeed->setHttpLastModified($feed->getLastModified()->format(DateTime::RSS));
}
$newFeed->setAdded($this->time->getTime());

Expand Down

0 comments on commit 36f3010

Please sign in to comment.