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

View File

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