Skip to content

Commit

Permalink
fix empty response for sites
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Sep 4, 2023
1 parent d1ce9c4 commit 93b7973
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Actions/ManagesUptime.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ trait ManagesUptime
*/
public function uptime(int $siteId, string $startedAt, string $endedAt, string $split = 'month'): array
{
$sites = $this->get("sites/$siteId/uptime?filter[started_at]={$startedAt}&filter[ended_at]={$endedAt}&split={$split}");

if (empty($sites)) {
$sites = [];
}

return $this->transformCollection(
$this->get("sites/$siteId/uptime?filter[started_at]={$startedAt}&filter[ended_at]={$endedAt}&split={$split}"),
$sites,
Uptime::class
);
}
Expand Down

0 comments on commit 93b7973

Please sign in to comment.