Skip to content

Commit

Permalink
Use existing $this->getMonitor() method for consistency (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraser Murray authored and freekmurze committed Oct 19, 2018
1 parent 7094dde commit fe444af
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Notifications/Notifications/CertificateExpiresSoon.php
Expand Up @@ -57,6 +57,6 @@ public function setEvent(SoonExpiringSslCertificateFoundEvent $event)

protected function getMessageText(): string
{
return "SSL certificate for {$this->event->monitor->url} expires soon";
return "SSL certificate for {$this->getMonitor()->url} expires soon";
}
}
6 changes: 3 additions & 3 deletions src/Notifications/Notifications/UptimeCheckFailed.php
Expand Up @@ -57,15 +57,15 @@ public function getMonitorProperties($extraProperties = []): array

$extraProperties = [
$since => $date,
'Failure reason' => $this->event->monitor->uptime_check_failure_reason,
'Failure reason' => $this->getMonitor()->uptime_check_failure_reason,
];

return parent::getMonitorProperties($extraProperties);
}

public function isStillRelevant(): bool
{
return $this->event->monitor->uptime_status == UptimeStatus::DOWN;
return $this->getMonitor()->uptime_status == UptimeStatus::DOWN;
}

public function setEvent(MonitorFailedEvent $event)
Expand All @@ -77,6 +77,6 @@ public function setEvent(MonitorFailedEvent $event)

protected function getMessageText(): string
{
return "{$this->event->monitor->url} seems down";
return "{$this->getMonitor()->url} seems down";
}
}
4 changes: 2 additions & 2 deletions src/Notifications/Notifications/UptimeCheckRecovered.php
Expand Up @@ -60,7 +60,7 @@ public function getMonitorProperties($extraProperties = []): array

public function isStillRelevant(): bool
{
return $this->event->monitor->uptime_status == UptimeStatus::UP;
return $this->getMonitor()->uptime_status == UptimeStatus::UP;
}

public function setEvent(MonitorRecoveredEvent $event)
Expand All @@ -72,6 +72,6 @@ public function setEvent(MonitorRecoveredEvent $event)

public function getMessageText(): string
{
return "{$this->event->monitor->url} has recovered after {$this->event->downtimePeriod->duration()}";
return "{$this->getMonitor()->url} has recovered after {$this->event->downtimePeriod->duration()}";
}
}
4 changes: 2 additions & 2 deletions src/Notifications/Notifications/UptimeCheckSucceeded.php
Expand Up @@ -49,7 +49,7 @@ public function toSlack($notifiable)

public function isStillRelevant(): bool
{
return $this->event->monitor->uptime_status != UptimeStatus::DOWN;
return $this->getMonitor()->uptime_status != UptimeStatus::DOWN;
}

public function setEvent(MonitorSucceededEvent $event)
Expand All @@ -61,6 +61,6 @@ public function setEvent(MonitorSucceededEvent $event)

public function getMessageText(): string
{
return "{$this->event->monitor->url} is up";
return "{$this->getMonitor()->url} is up";
}
}

0 comments on commit fe444af

Please sign in to comment.