1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-30 21:30:14 +02:00

refactor: FeedItem::setTimestamp() (#3711)

This commit is contained in:
Dag
2023-09-26 00:27:45 +02:00
committed by GitHub
parent f421c45b21
commit ae53adefad
5 changed files with 38 additions and 15 deletions

View File

@@ -147,14 +147,16 @@ class FeedItem
return $this->timestamp;
}
public function setTimestamp($timestamp)
public function setTimestamp($datetime)
{
$this->timestamp = null;
if (
!is_numeric($timestamp)
&& !$timestamp = strtotime($timestamp)
) {
Debug::log('Unable to parse timestamp!');
if (is_numeric($datetime)) {
$timestamp = $datetime;
} else {
$timestamp = strtotime($datetime);
if ($timestamp === false) {
Debug::log('Unable to parse timestamp!');
}
}
if ($timestamp <= 0) {
Debug::log('Timestamp must be greater than zero!');