mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-24 12:45:05 +02:00
refactor: FeedItem::setTimestamp() (#3711)
This commit is contained in:
parent
f421c45b21
commit
ae53adefad
5 changed files with 38 additions and 15 deletions
|
@ -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!');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue