| 1 |
<?php |
| 2 |
|
| 3 |
declare (strict_types=1); |
| 4 |
namespace WCPOS\Vendor\Sentry; |
| 5 |
|
| 6 |
final class MonitorConfig |
| 7 |
{ |
| 8 |
/** |
| 9 |
* @var MonitorSchedule The schedule of the monitor |
| 10 |
*/ |
| 11 |
private $schedule; |
| 12 |
/** |
| 13 |
* @var int|null The check-in margin in minutes |
| 14 |
*/ |
| 15 |
private $checkinMargin; |
| 16 |
/** |
| 17 |
* @var int|null The maximum runtime in minutes |
| 18 |
*/ |
| 19 |
private $maxRuntime; |
| 20 |
/** |
| 21 |
* @var string|null The timezone |
| 22 |
*/ |
| 23 |
private $timezone; |
| 24 |
/** |
| 25 |
* @var int|null The number of consecutive failed check-ins it takes before an issue is created |
| 26 |
*/ |
| 27 |
private $failureIssueThreshold; |
| 28 |
/** |
| 29 |
* @var int|null The number of consecutive OK check-ins it takes before an issue is resolved |
| 30 |
*/ |
| 31 |
private $recoveryThreshold; |
| 32 |
public function __construct(MonitorSchedule $schedule, ?int $checkinMargin = null, ?int $maxRuntime = null, ?string $timezone = null, ?int $failureIssueThreshold = null, ?int $recoveryThreshold = null) |
| 33 |
{ |
| 34 |
$this->schedule = $schedule; |
| 35 |
$this->checkinMargin = $checkinMargin; |
| 36 |
$this->maxRuntime = $maxRuntime; |
| 37 |
$this->timezone = $timezone; |
| 38 |
$this->failureIssueThreshold = $failureIssueThreshold; |
| 39 |
$this->recoveryThreshold = $recoveryThreshold; |
| 40 |
} |
| 41 |
public function getSchedule() : MonitorSchedule |
| 42 |
{ |
| 43 |
return $this->schedule; |
| 44 |
} |
| 45 |
public function setSchedule(MonitorSchedule $schedule) : self |
| 46 |
{ |
| 47 |
$this->schedule = $schedule; |
| 48 |
return $this; |
| 49 |
} |
| 50 |
public function getCheckinMargin() : ?int |
| 51 |
{ |
| 52 |
return $this->checkinMargin; |
| 53 |
} |
| 54 |
public function setCheckinMargin(?int $checkinMargin) : self |
| 55 |
{ |
| 56 |
$this->checkinMargin = $checkinMargin; |
| 57 |
return $this; |
| 58 |
} |
| 59 |
public function getMaxRuntime() : ?int |
| 60 |
{ |
| 61 |
return $this->maxRuntime; |
| 62 |
} |
| 63 |
public function setMaxRuntime(?int $maxRuntime) : self |
| 64 |
{ |
| 65 |
$this->maxRuntime = $maxRuntime; |
| 66 |
return $this; |
| 67 |
} |
| 68 |
public function getTimezone() : ?string |
| 69 |
{ |
| 70 |
return $this->timezone; |
| 71 |
} |
| 72 |
public function setTimezone(?string $timezone) : self |
| 73 |
{ |
| 74 |
$this->timezone = $timezone; |
| 75 |
return $this; |
| 76 |
} |
| 77 |
public function getFailureRecoveryThreshold() : ?int |
| 78 |
{ |
| 79 |
return $this->failureIssueThreshold; |
| 80 |
} |
| 81 |
public function setFailureRecoveryThreshold(?int $failureIssueThreshold) : self |
| 82 |
{ |
| 83 |
$this->failureIssueThreshold = $failureIssueThreshold; |
| 84 |
return $this; |
| 85 |
} |
| 86 |
public function getRecoveryThreshold() : ?int |
| 87 |
{ |
| 88 |
return $this->recoveryThreshold; |
| 89 |
} |
| 90 |
public function setRecoveryThreshold(?int $recoveryThreshold) : self |
| 91 |
{ |
| 92 |
$this->recoveryThreshold = $recoveryThreshold; |
| 93 |
return $this; |
| 94 |
} |
| 95 |
/** |
| 96 |
* @return array<string, mixed> |
| 97 |
*/ |
| 98 |
public function toArray() : array |
| 99 |
{ |
| 100 |
return ['schedule' => $this->schedule->toArray(), 'checkin_margin' => $this->checkinMargin, 'max_runtime' => $this->maxRuntime, 'timezone' => $this->timezone, 'failure_issue_threshold' => $this->failureIssueThreshold, 'recovery_threshold' => $this->recoveryThreshold]; |
| 101 |
} |
| 102 |
} |
| 103 |
|