- Fixed issue in \RssLib\Objects > RssItem where category isn't correctly parsed.

This commit is contained in:
Netkas 2023-08-13 19:01:53 -04:00
parent 9b588562da
commit d3ced2330d
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
2 changed files with 23 additions and 5 deletions

18
CHANGELOG.md Normal file
View file

@ -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

View file

@ -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(),