-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathPrompt.php
More file actions
61 lines (52 loc) · 1.39 KB
/
Copy pathPrompt.php
File metadata and controls
61 lines (52 loc) · 1.39 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
<?php
namespace Appwrite\Enums;
use JsonSerializable;
class Prompt implements JsonSerializable
{
private static Prompt $NONE;
private static Prompt $CONSENT;
private static Prompt $SELECTACCOUNT;
private string $value;
private function __construct(string $value)
{
$this->value = $value;
}
public function __toString(): string
{
return $this->value;
}
public function jsonSerialize(): string
{
return $this->value;
}
public static function NONE(): Prompt
{
if (!isset(self::$NONE)) {
self::$NONE = new Prompt('none');
}
return self::$NONE;
}
public static function CONSENT(): Prompt
{
if (!isset(self::$CONSENT)) {
self::$CONSENT = new Prompt('consent');
}
return self::$CONSENT;
}
public static function SELECTACCOUNT(): Prompt
{
if (!isset(self::$SELECTACCOUNT)) {
self::$SELECTACCOUNT = new Prompt('select_account');
}
return self::$SELECTACCOUNT;
}
public static function from(string $value): self
{
return match ($value) {
'none' => self::NONE(),
'consent' => self::CONSENT(),
'select_account' => self::SELECTACCOUNT(),
default => throw new \InvalidArgumentException('Unknown Prompt value: ' . $value),
};
}
}