| 1 |
<?php |
| 2 |
|
| 3 |
declare (strict_types=1); |
| 4 |
namespace WCPOS\Vendor\Sentry; |
| 5 |
|
| 6 |
use WCPOS\Vendor\Sentry\Util\SentryUid; |
| 7 |
final class CheckIn |
| 8 |
{ |
| 9 |
/** |
| 10 |
* @var string The check-in ID |
| 11 |
*/ |
| 12 |
private $id; |
| 13 |
/** |
| 14 |
* @var string The monitor slug |
| 15 |
*/ |
| 16 |
private $monitorSlug; |
| 17 |
/** |
| 18 |
* @var CheckInStatus The status of the check-in |
| 19 |
*/ |
| 20 |
private $status; |
| 21 |
/** |
| 22 |
* @var string|null The release |
| 23 |
*/ |
| 24 |
private $release; |
| 25 |
/** |
| 26 |
* @var string|null The environment |
| 27 |
*/ |
| 28 |
private $environment; |
| 29 |
/** |
| 30 |
* @var int|float|null The duration of the check-in in seconds |
| 31 |
*/ |
| 32 |
private $duration; |
| 33 |
/** |
| 34 |
* @var MonitorConfig|null The monitor configuration |
| 35 |
*/ |
| 36 |
private $monitorConfig; |
| 37 |
/** |
| 38 |
* @param int|float|null $duration The duration of the check-in in seconds |
| 39 |
*/ |
| 40 |
public function __construct(string $monitorSlug, CheckInStatus $status, ?string $id = null, ?string $release = null, ?string $environment = null, $duration = null, ?MonitorConfig $monitorConfig = null) |
| 41 |
{ |
| 42 |
$this->setMonitorSlug($monitorSlug); |
| 43 |
$this->setStatus($status); |
| 44 |
$this->setId($id ?? SentryUid::generate()); |
| 45 |
$this->setRelease($release ?? ''); |
| 46 |
$this->setEnvironment($environment ?? Event::DEFAULT_ENVIRONMENT); |
| 47 |
$this->setDuration($duration); |
| 48 |
$this->setMonitorConfig($monitorConfig); |
| 49 |
} |
| 50 |
public function getId() : string |
| 51 |
{ |
| 52 |
return $this->id; |
| 53 |
} |
| 54 |
public function setId(string $id) : void |
| 55 |
{ |
| 56 |
$this->id = $id; |
| 57 |
} |
| 58 |
public function getMonitorSlug() : string |
| 59 |
{ |
| 60 |
return $this->monitorSlug; |
| 61 |
} |
| 62 |
public function setMonitorSlug(string $monitorSlug) : self |
| 63 |
{ |
| 64 |
$this->monitorSlug = $monitorSlug; |
| 65 |
return $this; |
| 66 |
} |
| 67 |
public function getStatus() : CheckInStatus |
| 68 |
{ |
| 69 |
return $this->status; |
| 70 |
} |
| 71 |
public function setStatus(CheckInStatus $status) : self |
| 72 |
{ |
| 73 |
$this->status = $status; |
| 74 |
return $this; |
| 75 |
} |
| 76 |
public function getRelease() : ?string |
| 77 |
{ |
| 78 |
return $this->release; |
| 79 |
} |
| 80 |
public function setRelease(string $release) : self |
| 81 |
{ |
| 82 |
$this->release = $release; |
| 83 |
return $this; |
| 84 |
} |
| 85 |
public function getEnvironment() : ?string |
| 86 |
{ |
| 87 |
return $this->environment; |
| 88 |
} |
| 89 |
public function setEnvironment(string $environment) : self |
| 90 |
{ |
| 91 |
$this->environment = $environment; |
| 92 |
return $this; |
| 93 |
} |
| 94 |
/** |
| 95 |
* @return int|float|null |
| 96 |
*/ |
| 97 |
public function getDuration() |
| 98 |
{ |
| 99 |
return $this->duration; |
| 100 |
} |
| 101 |
/** |
| 102 |
* @param int|float|null $duration The duration of the check-in in seconds |
| 103 |
*/ |
| 104 |
public function setDuration($duration) : self |
| 105 |
{ |
| 106 |
$this->duration = $duration; |
| 107 |
return $this; |
| 108 |
} |
| 109 |
public function getMonitorConfig() : ?MonitorConfig |
| 110 |
{ |
| 111 |
return $this->monitorConfig; |
| 112 |
} |
| 113 |
public function setMonitorConfig(?MonitorConfig $monitorConfig) : self |
| 114 |
{ |
| 115 |
$this->monitorConfig = $monitorConfig; |
| 116 |
return $this; |
| 117 |
} |
| 118 |
} |
| 119 |
|