-
-
Notifications
You must be signed in to change notification settings - Fork 466
Expand file tree
/
Copy pathCheckInStatus.php
More file actions
55 lines (44 loc) · 1.03 KB
/
CheckInStatus.php
File metadata and controls
55 lines (44 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
declare(strict_types=1);
namespace Sentry;
/**
* This enum represents all the possible status of a check in.
*/
final class CheckInStatus
{
/**
* @var string The value of the enum instance
*/
private $value;
/**
* @var array<string, self> A list of cached enum instances
*/
private static $instances = [];
private function __construct(string $value)
{
$this->value = $value;
}
public static function ok(): self
{
return self::getInstance('ok');
}
public static function error(): self
{
return self::getInstance('error');
}
public static function inProgress(): self
{
return self::getInstance('in_progress');
}
public function __toString(): string
{
return $this->value;
}
private static function getInstance(string $value): self
{
if (!isset(self::$instances[$value])) {
self::$instances[$value] = new self($value);
}
return self::$instances[$value];
}
}