migliorato find monitor e contatti
This commit is contained in:
parent
6d1fdb9289
commit
b981b3cfdb
@ -144,7 +144,7 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
|
||||
* @param bool $forceRefresh
|
||||
* @return mixed|AlertContact|null
|
||||
*/
|
||||
public function find($id, $forceRefresh = false)
|
||||
public function find($id = null, $name = null, $value = null, $forceRefresh = false)
|
||||
{
|
||||
if (empty($this->cachedAlertContacts) || $forceRefresh) {
|
||||
$this->getAlertContacts();
|
||||
@ -152,7 +152,28 @@ class UptimeRobotAlertContacsService extends UptimeRobotService
|
||||
|
||||
/** @var AlertContact $alertContact */
|
||||
foreach ($this->cachedAlertContacts as $alertContact) {
|
||||
if ($alertContact->getId() === $id) {
|
||||
if ($alertContact->getId() === $id || $alertContact->getFriendlyName() === $name || $alertContact->getValue() === $value ) {
|
||||
return $alertContact;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param bool $forceRefresh
|
||||
* @return mixed|AlertContact|null
|
||||
*/
|
||||
public function findbyName($name, $forceRefresh = false)
|
||||
{
|
||||
if (empty($this->cachedAlertContacts) || $forceRefresh) {
|
||||
$this->getAlertContacts();
|
||||
}
|
||||
|
||||
/** @var AlertContact $alertContact */
|
||||
foreach ($this->cachedAlertContacts as $alertContact) {
|
||||
if ($alertContact->getFriendlyName() === $name) {
|
||||
return $alertContact;
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ class UptimeRobotMonitorService extends UptimeRobotService
|
||||
* @param bool $forceRefresh
|
||||
* @return mixed|Monitor|null
|
||||
*/
|
||||
public function find($id, $forceRefresh = false)
|
||||
public function find($id = null, $name = null, $url = null, $forceRefresh = false)
|
||||
{
|
||||
if (empty($this->cachedMonitors) || $forceRefresh) {
|
||||
$this->getMonitors();
|
||||
@ -231,7 +231,7 @@ class UptimeRobotMonitorService extends UptimeRobotService
|
||||
|
||||
/** @var Monitor $monitor */
|
||||
foreach ($this->cachedMonitors as $monitor) {
|
||||
if ($monitor->getId() === $id) {
|
||||
if ($monitor->getId() === $id || $monitor->getFriendlyName() === $name || $monitor->getUrl() === $url) {
|
||||
return $monitor;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user