src/FeedIo/Reader/Fixer/LastModified.php 1 location
|
@@ 24-37 (lines=14) @@
|
| 21 |
|
* @param Result $result |
| 22 |
|
* @return FixerAbstract |
| 23 |
|
*/ |
| 24 |
|
public function correct(Result $result) : FixerAbstract |
| 25 |
|
{ |
| 26 |
|
$feed = $result->getFeed(); |
| 27 |
|
$date = new \DateTime('@0'); |
| 28 |
|
|
| 29 |
|
if (is_null($feed->getLastModified()) || $feed->getLastModified() == $date) { |
| 30 |
|
$this->logger->notice("correct last modified date for feed {$feed->getTitle()}"); |
| 31 |
|
$feed->setLastModified( |
| 32 |
|
$this->searchLastModified($feed) |
| 33 |
|
); |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
return $this; |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
/** |
| 40 |
|
* @param FeedInterface $feed |
src/FeedIo/Reader/Fixer/LastModifiedSince.php 1 location
|
@@ 26-37 (lines=12) @@
|
| 23 |
|
* @throws \Exception |
| 24 |
|
* |
| 25 |
|
*/ |
| 26 |
|
public function correct(Result $result) : FixerAbstract |
| 27 |
|
{ |
| 28 |
|
$feed = $result->getFeed(); |
| 29 |
|
$date = new \DateTime('@0'); |
| 30 |
|
|
| 31 |
|
if (count($feed) === 0 && (is_null($feed->getLastModified()) || $feed->getLastModified() == $date)) { |
| 32 |
|
$this->logger->notice("set last modified date to modifiedSince arg for feed {$feed->getTitle()}"); |
| 33 |
|
$feed->setLastModified($result->getModifiedSince()); |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
return $this; |
| 37 |
|
} |
| 38 |
|
} |
| 39 |
|
|