File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,16 +12,16 @@ class FeedItem
1212 public ?Feed $ feed = null ;
1313 public ?string $ title = null ;
1414 public ?string $ link = null ;
15- public ? string $ description = null ;
15+ public string $ description = '' ;
1616 public array $ categories = [];
1717 public ?string $ creator = null ;
1818 public ?string $ image = null ;
1919 public ?DateTime $ date = null ;
2020
2121 public function compareDate (FeedItem $ other ): int
2222 {
23- $ ad = $ this ->date ?? new DateTime ('NOW ' );
24- $ bd = $ other ->date ?? new DateTime ('NOW ' );
23+ $ ad = $ this ->date ?? new DateTime ('@0 ' );
24+ $ bd = $ other ->date ?? new DateTime ('@0 ' );
2525
2626 if ($ ad == $ bd ) {
2727 return 0 ;
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ protected function getCategoriesElement(): ?BaseHtmlElement
103103
104104 protected function getContentElement (): ?BaseHtmlElement
105105 {
106- $ text = $ this ->item ->description ;
106+ $ text = $ this ->item ->description ?? '' ;
107107 $ description = new FeedContent ($ text );
108108
109109 return HtmlElement::create (
@@ -122,7 +122,10 @@ protected function getLink(): ?string
122122
123123 protected function getDate (): BaseHtmlElement
124124 {
125- return (new TimeAgo ($ this ->item ->date ->getTimestamp ()));
125+ $ d = $ this ->item ->date ;
126+ $ ts = $ this ->item ->date !== null ? $ this ->item ->date ->getTimestamp () : 0 ;
127+
128+ return (new TimeAgo ($ ts ));
126129 }
127130
128131 protected function assembleHeader (): BaseHtmlElement
You can’t perform that action at this time.
0 commit comments