From 71eb877ea4bef036e38dee99fcbd309b41322138 Mon Sep 17 00:00:00 2001 From: Netkas Date: Sun, 13 Aug 2023 19:01:53 -0400 Subject: [PATCH] - Fixed issue in `\RssLib\Objects > RssItem` where `category` isn't correctly parsed. --- CHANGELOG.md | 18 ++++++++++++++++++ src/RssLib/Objects/RssItem.php | 10 +++++----- 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d4e95fe --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,18 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [1.0.1] - 2023-08-13 + +### Fixed + - Fixed issue in `\RssLib\Objects > RssItem` where `category` isn't correctly parsed. + + +## [1.0.0] - 2023-08-13 + +### Added +- First Release diff --git a/src/RssLib/Objects/RssItem.php b/src/RssLib/Objects/RssItem.php index e117d84..34b5be6 100644 --- a/src/RssLib/Objects/RssItem.php +++ b/src/RssLib/Objects/RssItem.php @@ -86,15 +86,15 @@ namespace RssLib\Objects; $this->author = (string)$data['author']; } - if(array_key_exists('categories', $data)) + if(array_key_exists('category', $data)) { - if(is_string($data['categories'])) + if(is_string($data['category'])) { - $this->categories = [$data['categories']]; + $this->categories = [$data['category']]; } else { - $this->categories = (array)$data['categories']; + $this->categories = (array)$data['category']; } } @@ -234,7 +234,7 @@ namespace RssLib\Objects; 'link' => $this->link, 'description' => $this->description, 'author' => $this->author, - 'categories' => $this->categories, + 'category' => $this->categories, 'comments' => $this->comments, 'enclosure' => $this->enclosure?->toArray(), 'guid' => $this->guid?->toArray(),