fix status
This commit is contained in:
parent
9ffc956e81
commit
8d33a26168
@ -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
|
||||
@ -152,7 +159,7 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
|
||||
|
||||
/** @var AlertContact $alertContact */
|
||||
foreach ($this->cachedAlertContacts as $alertContact) {
|
||||
if ($alertContact->getId() === $id || $alertContact->getFriendlyName() === $name || $alertContact->getValue() === $value ) {
|
||||
if ($alertContact->getId() === $id || $alertContact->getFriendlyName() === $name || $alertContact->getValue() === $value) {
|
||||
return $alertContact;
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ class UptimeRobotMonitorService extends UptimeRobotService
|
||||
'status' => $monitor->getStatus()
|
||||
];
|
||||
|
||||
if (!empty($alertContactsString)){
|
||||
if (!empty($alertContactsString)) {
|
||||
$params['alert_contacts'] = $alertContactsString;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user