From 24e6f5fcf75387a9611d07dcee91379d86881f11 Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 24 Mar 2024 14:41:25 +0100 Subject: [PATCH] Fix compatibility by removing type constraints --- src/main/php/xml/rdf/RDFNewsFeed.class.php | 55 +++++++++++----------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/src/main/php/xml/rdf/RDFNewsFeed.class.php b/src/main/php/xml/rdf/RDFNewsFeed.class.php index 8cb5ae83..4fd2d64e 100755 --- a/src/main/php/xml/rdf/RDFNewsFeed.class.php +++ b/src/main/php/xml/rdf/RDFNewsFeed.class.php @@ -1,8 +1,7 @@ channel->title= $title; $this->channel->link= $link; @@ -116,22 +115,22 @@ public function setChannel( $this->channel->publisher= $publisher; $this->channel->copyright= $rights; - $node= (new \xml\Node('channel')) - ->withChild(new \xml\Node('title', $title)) - ->withChild(new \xml\Node('link', $link)) - ->withChild(new \xml\Node('description', $description)) - ->withChild(new \xml\Node('dc:language', $language)) - ->withChild(new \xml\Node('dc:date', $date->toString(DATE_ATOM))) - ->withChild(new \xml\Node('dc:creator', $creator)) - ->withChild(new \xml\Node('dc:publisher', $publisher)) - ->withChild(new \xml\Node('dc:rights', $rights)) + $node= (new Node('channel')) + ->withChild(new Node('title', $title)) + ->withChild(new Node('link', $link)) + ->withChild(new Node('description', $description)) + ->withChild(new Node('dc:language', $language)) + ->withChild(new Node('dc:date', $date->toString(DATE_ATOM))) + ->withChild(new Node('dc:creator', $creator)) + ->withChild(new Node('dc:publisher', $publisher)) + ->withChild(new Node('dc:rights', $rights)) ; $node->setAttribute('rdf:about', $link); - $items= $node->addChild(new \xml\Node('items'));; + $items= $node->addChild(new Node('items'));; $this->channel->node= $node; - $this->channel->sequence= $items->addChild(new \xml\Node('rdf:Seq')); + $this->channel->sequence= $items->addChild(new Node('rdf:Seq')); $this->root()->clearChildren(); $this->root()->addChild($node); @@ -149,10 +148,10 @@ public function setImage($title, $url, $link= '') { $this->image->url= $url; $this->image->title= $title; - $node= (new \xml\Node('image')) - ->withChild(new \xml\Node('title', $title)) - ->withChild(new \xml\Node('url', $url)) - ->withChild(new \xml\Node('link', $link)) + $node= (new Node('image')) + ->withChild(new Node('title', $title)) + ->withChild(new Node('url', $url)) + ->withChild(new Node('link', $link)) ; if (!isset($this->image->node)) $node= $this->root()->addChild($node); $this->image->node= $node; @@ -184,10 +183,10 @@ public static function fromFile($file, $c= __CLASS__) { * @param string title * @param string link * @param string description default '' - * @param string util.Date default NULL date defaulting to current date/time + * @param ?util.Date default NULL date defaulting to current date/time * @return object the added item */ - public function addItem($title, $link, $description= '', Date $date= null) { + public function addItem($title, $link, $description= '', $date= null) { if (null === $date) { $date= $this->channel->date ?? Date::now(); } @@ -197,16 +196,16 @@ public function addItem($title, $link, $description= '', Date $date= null) { $item->link= $link; $item->description= $description; - $node= (new \xml\Node('item')) - ->withChild(new \xml\Node('title', $title)) - ->withChild(new \xml\Node('link', $link)) - ->withChild(new \xml\Node('description', $description)) - ->withChild(new \xml\Node('dc:date', $date->toString(DATE_ATOM))) + $node= (new Node('item')) + ->withChild(new Node('title', $title)) + ->withChild(new Node('link', $link)) + ->withChild(new Node('description', $description)) + ->withChild(new Node('dc:date', $date->toString(DATE_ATOM))) ; $node->setAttribute('rdf:about', $link); $item->node= $this->root()->addChild($node); $this->items[]= $item; - $this->channel->sequence->addChild(new \xml\Node('rdf:li', null, ['rdf:resource' => $link])); + $this->channel->sequence->addChild(new Node('rdf:li', null, ['rdf:resource' => $link])); return $item; }