-
-
Notifications
You must be signed in to change notification settings - Fork 468
Expand file tree
/
Copy pathEventType.php
More file actions
92 lines (77 loc) · 1.86 KB
/
EventType.php
File metadata and controls
92 lines (77 loc) · 1.86 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
declare(strict_types=1);
namespace Sentry;
/**
* This enum represents all the possible types of events that a Sentry server
* supports.
*
* @author Stefano Arlandini <sarlandini@alice.it>
*/
final class EventType implements \Stringable
{
/**
* @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 event(): self
{
return self::getInstance('event');
}
public static function transaction(): self
{
return self::getInstance('transaction');
}
public static function checkIn(): self
{
return self::getInstance('check_in');
}
public static function logs(): self
{
return self::getInstance('log');
}
public static function profileChunk(): self
{
return self::getInstance('profile_chunk');
}
/**
* @deprecated Metrics are no longer supported. Metrics API is a no-op and will be removed in 5.x.
*/
public static function metrics(): self
{
return self::getInstance('metrics');
}
/**
* List of all cases on the enum.
*
* @return self[]
*/
public static function cases(): array
{
return [
self::event(),
self::transaction(),
self::checkIn(),
self::logs(),
self::metrics(),
];
}
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];
}
}