summaryrefslogtreecommitdiff
path: root/classes/FeedParser.php
diff options
context:
space:
mode:
authorwn_ <invalid@email.com>2024-11-23 19:18:52 +0000
committerwn_ <invalid@email.com>2024-11-24 13:45:26 +0000
commit9b0baf9b32a7f1c299c4bb2127dc192a7daa1ac9 (patch)
treeb57ea5ecf13f9d8333a68cb6c7e7a4b5928d97b9 /classes/FeedParser.php
parent43e8864eada6a192732919ab1a96f8e0a672f6af (diff)
Use match expressions in some places.
Diffstat (limited to 'classes/FeedParser.php')
-rw-r--r--classes/FeedParser.php22
1 files changed, 9 insertions, 13 deletions
diff --git a/classes/FeedParser.php b/classes/FeedParser.php
index 729d77206..105708aa2 100644
--- a/classes/FeedParser.php
+++ b/classes/FeedParser.php
@@ -72,19 +72,15 @@ class FeedParser {
$root = $root_list->item(0);
if ($root) {
- switch (mb_strtolower($root->tagName)) {
- case "rdf:rdf":
- $this->type = $this::FEED_RDF;
- break;
- case "channel":
- $this->type = $this::FEED_RSS;
- break;
- case "feed":
- case "atom:feed":
- $this->type = $this::FEED_ATOM;
- break;
- default:
- $this->error ??= "Unknown/unsupported feed type";
+ $this->type = match (mb_strtolower($root->tagName)) {
+ 'rdf:rdf' => $this::FEED_RDF,
+ 'channel' => $this::FEED_RSS,
+ 'feed', 'atom:feed' => $this::FEED_ATOM,
+ default => null,
+ };
+
+ if (!$this->type) {
+ $this->error ??= 'Unknown/unsupported feed type';
return;
}
}