Bumped version to 1.0.2

This commit is contained in:
Netkas 2023-07-29 16:23:30 -04:00
parent ec2af99f86
commit 5fccdb0909
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
3 changed files with 24 additions and 11 deletions

View file

@ -5,6 +5,13 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.2] - 2023-07-29
### Fixed
* Minor bug fix
## [1.0.1] - 2023-07-29 ## [1.0.1] - 2023-07-29
### Fixed ### Fixed
@ -12,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
wrapper class. wrapper class.
## [1.0.0] - 2023-07-23 ## [1.0.0] - 2023-07-23
### Added ### Added

View file

@ -12,7 +12,7 @@
"assembly": { "assembly": {
"name": "Keybert", "name": "Keybert",
"package": "net.nosial.keybert", "package": "net.nosial.keybert",
"version": "1.0.1", "version": "1.0.2",
"uuid": "1695515c-2857-11ee-a7a6-6d740ea6cd07" "uuid": "1695515c-2857-11ee-a7a6-6d740ea6cd07"
}, },
"execution_policies": [ "execution_policies": [

View file

@ -346,26 +346,27 @@
*/ */
private function parseResults($results): array private function parseResults($results): array
{ {
if (is_array($results))
{
// check if the results are multi or single
if(is_array($results[0][0]))
{
// This is a multi-results
$parsedResults = []; $parsedResults = [];
foreach($results as $result)
if (is_array($results) && isset($results[0]))
{
// Check if the results are multi or single
if (is_array($results[0]) && isset($results[0][0]) && is_array($results[0][0]))
{
// This is multi-results
foreach ($results as $result)
{ {
$parsedResults[] = $this->parseSingleResult($result); $parsedResults[] = $this->parseSingleResult($result);
} }
} }
else elseif (is_array($results[0]))
{ {
// This is a single-result // This is a single-result
$parsedResults = $this->parseSingleResult($results); $parsedResults = $this->parseSingleResult($results);
} }
} }
return $parsedResults ?? []; return $parsedResults;
} }
/** /**
@ -377,10 +378,14 @@
private function parseSingleResult($result): array private function parseSingleResult($result): array
{ {
$parsedResult = []; $parsedResult = [];
foreach($result as $keywordScore)
foreach ($result as $keywordScore)
{
if (is_array($keywordScore) && count($keywordScore) === 2)
{ {
$parsedResult[$keywordScore[0]] = $keywordScore[1]; $parsedResult[$keywordScore[0]] = $keywordScore[1];
} }
}
return $parsedResult; return $parsedResult;
} }