1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PtrTn\Battlerite\Dto; |
4
|
|
|
|
5
|
|
|
use Webmozart\Assert\Assert; |
6
|
|
|
|
7
|
|
|
class Participant |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var string |
11
|
|
|
*/ |
12
|
|
|
public $type; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @var string |
16
|
|
|
*/ |
17
|
|
|
public $id; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
public $actor; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
public $shardId; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var int |
31
|
|
|
*/ |
32
|
|
|
public $abilityUses; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var int |
36
|
|
|
*/ |
37
|
|
|
public $attachment; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var int |
41
|
|
|
*/ |
42
|
|
|
public $damageDone; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var int |
46
|
|
|
*/ |
47
|
|
|
public $damageReceived; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var int |
51
|
|
|
*/ |
52
|
|
|
public $deaths; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var int |
56
|
|
|
*/ |
57
|
|
|
public $disablesDone; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var int |
61
|
|
|
*/ |
62
|
|
|
public $disablesReceived; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var int |
66
|
|
|
*/ |
67
|
|
|
public $emote; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var int |
71
|
|
|
*/ |
72
|
|
|
public $energyGained; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @var int |
76
|
|
|
*/ |
77
|
|
|
public $energyUsed; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var int |
81
|
|
|
*/ |
82
|
|
|
public $healingDone; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @var int |
86
|
|
|
*/ |
87
|
|
|
public $healingReceived; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @var int |
91
|
|
|
*/ |
92
|
|
|
public $kills; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @var int |
96
|
|
|
*/ |
97
|
|
|
public $mount; |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @var int |
101
|
|
|
*/ |
102
|
|
|
public $outfit; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @var int |
106
|
|
|
*/ |
107
|
|
|
public $score; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @var int |
111
|
|
|
*/ |
112
|
|
|
public $side; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @var int |
116
|
|
|
*/ |
117
|
|
|
public $timeAlive; |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @var string |
121
|
|
|
*/ |
122
|
|
|
public $userID; |
123
|
|
|
|
124
|
1 |
|
private function __construct( |
125
|
|
|
string $type, |
126
|
|
|
string $id, |
127
|
|
|
string $actor, |
128
|
|
|
string $shardId, |
129
|
|
|
int $abilityUses, |
130
|
|
|
int $attachment, |
131
|
|
|
int $damageDone, |
132
|
|
|
int $damageReceived, |
133
|
|
|
int $deaths, |
134
|
|
|
int $disablesDone, |
135
|
|
|
int $disablesReceived, |
136
|
|
|
int $emote, |
137
|
|
|
int $energyGained, |
138
|
|
|
int $energyUsed, |
139
|
|
|
int $healingDone, |
140
|
|
|
int $healingReceived, |
141
|
|
|
int $kills, |
142
|
|
|
int $mount, |
143
|
|
|
int $outfit, |
144
|
|
|
int $score, |
145
|
|
|
int $side, |
146
|
|
|
int $timeAlive, |
147
|
|
|
string $userID |
148
|
|
|
) { |
149
|
1 |
|
$this->type = $type; |
150
|
1 |
|
$this->id = $id; |
151
|
1 |
|
$this->actor = $actor; |
152
|
1 |
|
$this->shardId = $shardId; |
153
|
1 |
|
$this->abilityUses = $abilityUses; |
154
|
1 |
|
$this->attachment = $attachment; |
155
|
1 |
|
$this->damageDone = $damageDone; |
156
|
1 |
|
$this->damageReceived = $damageReceived; |
157
|
1 |
|
$this->deaths = $deaths; |
158
|
1 |
|
$this->disablesDone = $disablesDone; |
159
|
1 |
|
$this->disablesReceived = $disablesReceived; |
160
|
1 |
|
$this->emote = $emote; |
161
|
1 |
|
$this->energyGained = $energyGained; |
162
|
1 |
|
$this->energyUsed = $energyUsed; |
163
|
1 |
|
$this->healingDone = $healingDone; |
164
|
1 |
|
$this->healingReceived = $healingReceived; |
165
|
1 |
|
$this->kills = $kills; |
166
|
1 |
|
$this->mount = $mount; |
167
|
1 |
|
$this->outfit = $outfit; |
168
|
1 |
|
$this->score = $score; |
169
|
1 |
|
$this->side = $side; |
170
|
1 |
|
$this->timeAlive = $timeAlive; |
171
|
1 |
|
$this->userID = $userID; |
172
|
1 |
|
} |
173
|
|
|
|
174
|
1 |
|
public static function createFromArray(array $participant): self |
175
|
|
|
{ |
176
|
1 |
|
Assert::string($participant['type']); |
177
|
1 |
|
Assert::string($participant['id']); |
178
|
1 |
|
Assert::string($participant['attributes']['actor']); |
179
|
1 |
|
Assert::string($participant['attributes']['shardId']); |
180
|
1 |
|
Assert::integer($participant['attributes']['stats']['abilityUses']); |
181
|
1 |
|
Assert::integer($participant['attributes']['stats']['attachment']); |
182
|
1 |
|
Assert::integer($participant['attributes']['stats']['damageDone']); |
183
|
1 |
|
Assert::integer($participant['attributes']['stats']['damageReceived']); |
184
|
1 |
|
Assert::integer($participant['attributes']['stats']['deaths']); |
185
|
1 |
|
Assert::integer($participant['attributes']['stats']['disablesDone']); |
186
|
1 |
|
Assert::integer($participant['attributes']['stats']['disablesReceived']); |
187
|
1 |
|
Assert::integer($participant['attributes']['stats']['emote']); |
188
|
1 |
|
Assert::integer($participant['attributes']['stats']['energyGained']); |
189
|
1 |
|
Assert::integer($participant['attributes']['stats']['energyUsed']); |
190
|
1 |
|
Assert::integer($participant['attributes']['stats']['healingDone']); |
191
|
1 |
|
Assert::integer($participant['attributes']['stats']['healingReceived']); |
192
|
1 |
|
Assert::integer($participant['attributes']['stats']['kills']); |
193
|
1 |
|
Assert::integer($participant['attributes']['stats']['mount']); |
194
|
1 |
|
Assert::integer($participant['attributes']['stats']['outfit']); |
195
|
1 |
|
Assert::integer($participant['attributes']['stats']['score']); |
196
|
1 |
|
Assert::integer($participant['attributes']['stats']['side']); |
197
|
1 |
|
Assert::integer($participant['attributes']['stats']['timeAlive']); |
198
|
1 |
|
Assert::string($participant['attributes']['stats']['userID']); |
199
|
|
|
|
200
|
1 |
|
return new self( |
201
|
1 |
|
$participant['type'], |
202
|
1 |
|
$participant['id'], |
203
|
1 |
|
$participant['attributes']['actor'], |
204
|
1 |
|
$participant['attributes']['shardId'], |
205
|
1 |
|
$participant['attributes']['stats']['abilityUses'], |
206
|
1 |
|
$participant['attributes']['stats']['attachment'], |
207
|
1 |
|
$participant['attributes']['stats']['damageDone'], |
208
|
1 |
|
$participant['attributes']['stats']['damageReceived'], |
209
|
1 |
|
$participant['attributes']['stats']['deaths'], |
210
|
1 |
|
$participant['attributes']['stats']['disablesDone'], |
211
|
1 |
|
$participant['attributes']['stats']['disablesReceived'], |
212
|
1 |
|
$participant['attributes']['stats']['emote'], |
213
|
1 |
|
$participant['attributes']['stats']['energyGained'], |
214
|
1 |
|
$participant['attributes']['stats']['energyUsed'], |
215
|
1 |
|
$participant['attributes']['stats']['healingDone'], |
216
|
1 |
|
$participant['attributes']['stats']['healingReceived'], |
217
|
1 |
|
$participant['attributes']['stats']['kills'], |
218
|
1 |
|
$participant['attributes']['stats']['mount'], |
219
|
1 |
|
$participant['attributes']['stats']['outfit'], |
220
|
1 |
|
$participant['attributes']['stats']['score'], |
221
|
1 |
|
$participant['attributes']['stats']['side'], |
222
|
1 |
|
$participant['attributes']['stats']['timeAlive'], |
223
|
1 |
|
$participant['attributes']['stats']['userID'] |
224
|
|
|
); |
225
|
|
|
} |
226
|
|
|
} |
227
|
|
|
|