Compare commits

...

2 commits

4 changed files with 39 additions and 8 deletions

23
CHANGELOG.md Normal file
View file

@ -0,0 +1,23 @@
# 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.2] - 2023-08-13
### Fixed
- Fixed issue in `\RssLib\Objects\RssFeed > Guid` where `guid` isn't correctly parsed if the "isPermaLink" attribute is missing.
## [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

@ -13,7 +13,7 @@
"description": "A library used to parse RSS feeds",
"company": "Nosial",
"copyright": "Copyright (c) 2022-2023 Nosial",
"version": "1.0.0",
"version": "1.0.2",
"uuid": "f24416e8-39f0-11ee-8dcf-f362baa8b68c"
},
"build": {

View file

@ -22,10 +22,18 @@
/**
* Public Constructor
*
* @param array $data
* @param array|string $data
*/
public function __construct(array $data)
public function __construct(array|string $data)
{
if(is_string($data))
{
$data = [
'guid' => $data,
'guid_isPermalink' => false
];
}
if(!array_key_exists('guid', $data))
{
throw new InvalidArgumentException('Missing required key guid for guid');

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