fix status

This commit is contained in:
Giuseppe Nucifora 2022-07-22 12:38:42 +02:00
parent 9ffc956e81
commit 8d33a26168
2 changed files with 74 additions and 62 deletions

View File

@ -26,6 +26,7 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
$response = json_decode($jsonResponse);
if ($response) {
switch ($response->stat) {
case 'ok':
@ -40,6 +41,7 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
default:
break;
}
}
return $this->cachedAlertContacts;
@ -66,7 +68,7 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
}
$response = json_decode($jsonResponse);
if ($response) {
switch ($response->stat) {
case 'ok':
$alertContact->setId($response->alertcontact->id);
@ -76,7 +78,8 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
return false;
break;
}
}
return null;
}
/**
@ -102,16 +105,18 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
$response = json_decode($jsonResponse);
if ($response) {
switch ($response->stat) {
case 'ok':
$alertContact->setId($response->alert_contact->id);
return $alertContact;
break;
default:
return false;
return null;
break;
}
}
}
/**
* @param AlertContact $alertContact
@ -128,16 +133,18 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
}
$response = json_decode($jsonResponse);
if ($response) {
switch ($response->stat) {
case 'ok':
return $alertContact;
break;
default:
return false;
return null;
break;
}
}
return null;
}
/**
* @param $id

View File

@ -156,7 +156,7 @@ class UptimeRobotMonitorService extends UptimeRobotService
}
$response = json_decode($jsonResponse);
if ($response) {
switch ($response->stat) {
case 'ok':
$monitor->setId($response->monitor->id);
@ -167,6 +167,7 @@ class UptimeRobotMonitorService extends UptimeRobotService
break;
}
}
}
/**
* @param Monitor $monitor
@ -183,7 +184,7 @@ class UptimeRobotMonitorService extends UptimeRobotService
}
$response = json_decode($jsonResponse);
if ($response) {
switch ($response->stat) {
case 'ok':
return $monitor;
@ -193,6 +194,8 @@ class UptimeRobotMonitorService extends UptimeRobotService
break;
}
}
return null;
}
/**
* @param Monitor $monitor
@ -209,7 +212,7 @@ class UptimeRobotMonitorService extends UptimeRobotService
}
$response = json_decode($jsonResponse);
if ($response) {
switch ($response->stat) {
case 'ok':
return $monitor;
@ -219,6 +222,8 @@ class UptimeRobotMonitorService extends UptimeRobotService
break;
}
}
return null;
}
/**
* @param $id