Compare commits

..

No commits in common. "master" and "1.0.1" have entirely different histories.

3 changed files with 11 additions and 24 deletions

View file

@ -5,13 +5,6 @@ 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
@ -19,7 +12,6 @@ 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.2", "version": "1.0.1",
"uuid": "1695515c-2857-11ee-a7a6-6d740ea6cd07" "uuid": "1695515c-2857-11ee-a7a6-6d740ea6cd07"
}, },
"execution_policies": [ "execution_policies": [

View file

@ -346,27 +346,26 @@
*/ */
private function parseResults($results): array private function parseResults($results): array
{ {
$parsedResults = []; if (is_array($results))
if (is_array($results) && isset($results[0]))
{ {
// Check if the results are multi or single // check if the results are multi or single
if (is_array($results[0]) && isset($results[0][0]) && is_array($results[0][0])) if(is_array($results[0][0]))
{ {
// This is multi-results // This is a multi-results
foreach ($results as $result) $parsedResults = [];
foreach($results as $result)
{ {
$parsedResults[] = $this->parseSingleResult($result); $parsedResults[] = $this->parseSingleResult($result);
} }
} }
elseif (is_array($results[0])) else
{ {
// This is a single-result // This is a single-result
$parsedResults = $this->parseSingleResult($results); $parsedResults = $this->parseSingleResult($results);
} }
} }
return $parsedResults; return $parsedResults ?? [];
} }
/** /**
@ -378,13 +377,9 @@
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;