-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathActionError.php
More file actions
84 lines (74 loc) · 1.97 KB
/
ActionError.php
File metadata and controls
84 lines (74 loc) · 1.97 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
<?php
declare(strict_types=1);
namespace MatchBot\Application\Actions;
use JetBrains\PhpStorm\ArrayShape;
use JetBrains\PhpStorm\Pure;
use JsonSerializable;
class ActionError implements JsonSerializable
{
public const string BAD_REQUEST = 'BAD_REQUEST';
public const string INSUFFICIENT_PRIVILEGES = 'INSUFFICIENT_PRIVILEGES';
public const string NOT_ALLOWED = 'NOT_ALLOWED';
public const string NOT_IMPLEMENTED = 'NOT_IMPLEMENTED';
public const string RESOURCE_NOT_FOUND = 'RESOURCE_NOT_FOUND';
public const string SERVER_ERROR = 'SERVER_ERROR';
public const string UNAUTHENTICATED = 'UNAUTHENTICATED';
public const string VALIDATION_ERROR = 'VALIDATION_ERROR';
public const string VERIFICATION_ERROR = 'VERIFICATION_ERROR';
public const string INSUFFICIENT_MATCH_FUNDS = 'INSUFFICIENT_MATCH_FUNDS';
/**
* @param array<string, mixed> $data
*/
#[Pure]
public function __construct(
private string $type,
private ?string $description,
private array $data = [],
) {
}
/**
* @return string
*/
#[Pure]
public function getType(): string
{
return $this->type;
}
/**
* @param string $type
* @return self
*/
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
/**
* @return null|string
*/
#[Pure]
public function getDescription(): string|null
{
return $this->description;
}
/**
* @param string|null $description
* @return self
*/
public function setDescription(?string $description = null): self
{
$this->description = $description;
return $this;
}
/**
* @return array{type: string, description: string, ...}
*/
#[\Override]
public function jsonSerialize(): array
{
return [
'type' => $this->type,
'description' => $this->description,
] + $this->data;
}
}