Skip to content

Commit f6a92c8

Browse files
committed
fix(inpi-rne-client): fixes
1 parent e9f1c2d commit f6a92c8

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/InpiRNEClient.php

+5-14
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public function searchCompaniesByActivitySector(string $activitySector, int $pag
306306
}
307307

308308
$url = "api/companies?";
309-
$url .= "activitySectors[]={$activitySector}&";
309+
$url .= "activitySectors={$activitySector}&";
310310

311311
$url = $this->addPageToUrl($url, $page);
312312
$url = $this->addPageSizeToUrl($url, $pageSize);
@@ -458,20 +458,11 @@ private function decorateResponse(array $data, int $pageSize = self::DEFAULT_PAG
458458
{
459459
// decorate the response to add results count
460460
// if page size is reached, we need to indicate there are more results
461-
// add url of the next request to get the next page
462461
$dataCount = count($data);
463-
$decoratedData = [
464-
'resultsCount' => $dataCount,
465-
'results' => $data
466-
];
467-
468-
if ($dataCount === $pageSize) {
469-
$decoratedData['hasMoreResults'] = true;
470-
} else if ($dataCount < $pageSize) {
471-
$decoratedData['hasMoreResults'] = false;
472-
} else {
473-
throw new \Exception('The number of results is greater than the page size.');
474-
}
462+
$decoratedData['resultsCount'] = $dataCount;
463+
$decoratedData['hasMoreResults'] = false;
464+
if ($dataCount === $pageSize) $decoratedData['hasMoreResults'] = true;
465+
$decoratedData['results'] = $data;
475466

476467
return $decoratedData;
477468
}

0 commit comments

Comments
 (0)