public function findItemDate(SimpleXMLElement $entry, Item $item, Feed $feed)
{
$this->findItemPublishedDate($entry, $item, $feed);
$this->findItemUpdatedDate($entry, $item, $feed);
if ($item->getPublishedDate() === null) {
// Use the updated date if available, otherwise use the feed date
$item->setPublishedDate($item->getUpdatedDate() ?: $feed->getDate());
}
if ($item->getUpdatedDate() === null) {
// Use the published date as fallback
$item->setUpdatedDate($item->getPublishedDate());
}
// Use the most recent of published and updated dates
$item->setDate(max($item->getPublishedDate(), $item->getUpdatedDate()));
}