1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NekoAPI\Component\Entity; |
4
|
|
|
|
5
|
|
|
use DateTime; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class Information |
9
|
|
|
* |
10
|
|
|
* @package NekoAPI\Component\Entity |
11
|
|
|
* @author Aurimas Niekis <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
class Information extends BaseEntity |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var Type |
17
|
|
|
*/ |
18
|
|
|
private $type; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var int |
22
|
|
|
*/ |
23
|
|
|
private $episodes; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var Status |
27
|
|
|
*/ |
28
|
|
|
private $status; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var DateTime |
32
|
|
|
*/ |
33
|
|
|
private $airedFrom; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var DateTime |
37
|
|
|
*/ |
38
|
|
|
private $airedTo; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var Season |
42
|
|
|
*/ |
43
|
|
|
private $premiered; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var string |
47
|
|
|
*/ |
48
|
|
|
private $broadcast; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var Producer[] |
52
|
|
|
*/ |
53
|
|
|
private $producers; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var Producer[] |
57
|
|
|
*/ |
58
|
|
|
private $licensees; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var Producer[] |
62
|
|
|
*/ |
63
|
|
|
private $studios; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var Source |
67
|
|
|
*/ |
68
|
|
|
private $source; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @var Genre[] |
72
|
|
|
*/ |
73
|
|
|
private $genres; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @var string |
77
|
|
|
*/ |
78
|
|
|
private $duration; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @var string |
82
|
|
|
*/ |
83
|
|
|
private $rating; |
84
|
|
|
|
85
|
2 |
|
public function __construct() |
86
|
|
|
{ |
87
|
2 |
|
$this->producers = []; |
88
|
2 |
|
$this->licensees = []; |
89
|
2 |
|
$this->studios = []; |
90
|
2 |
|
$this->genres = []; |
91
|
2 |
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @return Type |
95
|
|
|
*/ |
96
|
2 |
|
public function getType(): ?Type |
97
|
|
|
{ |
98
|
2 |
|
return $this->type; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @param Type $type |
103
|
|
|
* |
104
|
|
|
* @return Information |
105
|
|
|
*/ |
106
|
2 |
|
public function setType(Type $type): Information |
107
|
|
|
{ |
108
|
2 |
|
$this->type = $type; |
109
|
|
|
|
110
|
2 |
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @return int |
115
|
|
|
*/ |
116
|
2 |
|
public function getEpisodes(): ?int |
117
|
|
|
{ |
118
|
2 |
|
return $this->episodes; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @param int $episodes |
123
|
|
|
* |
124
|
|
|
* @return Information |
125
|
|
|
*/ |
126
|
2 |
|
public function setEpisodes(int $episodes): Information |
127
|
|
|
{ |
128
|
2 |
|
$this->episodes = $episodes; |
129
|
|
|
|
130
|
2 |
|
return $this; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @return Status |
135
|
|
|
*/ |
136
|
2 |
|
public function getStatus(): ?Status |
137
|
|
|
{ |
138
|
2 |
|
return $this->status; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @param Status $status |
143
|
|
|
* |
144
|
|
|
* @return Information |
145
|
|
|
*/ |
146
|
2 |
|
public function setStatus(Status $status): Information |
147
|
|
|
{ |
148
|
2 |
|
$this->status = $status; |
149
|
|
|
|
150
|
2 |
|
return $this; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @return DateTime |
155
|
|
|
*/ |
156
|
2 |
|
public function getAiredFrom(): ?DateTime |
157
|
|
|
{ |
158
|
2 |
|
return $this->airedFrom; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @param DateTime $airedFrom |
163
|
|
|
* |
164
|
|
|
* @return Information |
165
|
|
|
*/ |
166
|
2 |
|
public function setAiredFrom(DateTime $airedFrom): Information |
167
|
|
|
{ |
168
|
2 |
|
$this->airedFrom = $airedFrom; |
169
|
|
|
|
170
|
2 |
|
return $this; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @return DateTime |
175
|
|
|
*/ |
176
|
2 |
|
public function getAiredTo(): ?DateTime |
177
|
|
|
{ |
178
|
2 |
|
return $this->airedTo; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @param DateTime $airedTo |
183
|
|
|
* |
184
|
|
|
* @return Information |
185
|
|
|
*/ |
186
|
2 |
|
public function setAiredTo(DateTime $airedTo): Information |
187
|
|
|
{ |
188
|
2 |
|
$this->airedTo = $airedTo; |
189
|
|
|
|
190
|
2 |
|
return $this; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @return Season |
195
|
|
|
*/ |
196
|
2 |
|
public function getPremiered(): ?Season |
197
|
|
|
{ |
198
|
2 |
|
return $this->premiered; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @param Season $premiered |
203
|
|
|
* |
204
|
|
|
* @return Information |
205
|
|
|
*/ |
206
|
2 |
|
public function setPremiered(Season $premiered): Information |
207
|
|
|
{ |
208
|
2 |
|
$this->premiered = $premiered; |
209
|
|
|
|
210
|
2 |
|
return $this; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* @return string |
215
|
|
|
*/ |
216
|
2 |
|
public function getBroadcast(): ?string |
217
|
|
|
{ |
218
|
2 |
|
return $this->broadcast; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* @param string $broadcast |
223
|
|
|
* |
224
|
|
|
* @return Information |
225
|
|
|
*/ |
226
|
2 |
|
public function setBroadcast(string $broadcast): Information |
227
|
|
|
{ |
228
|
2 |
|
$this->broadcast = $broadcast; |
229
|
|
|
|
230
|
2 |
|
return $this; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* @return Producer[] |
235
|
|
|
*/ |
236
|
2 |
|
public function getProducers(): array |
237
|
|
|
{ |
238
|
2 |
|
return $this->producers; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* @param Producer[] $producers |
243
|
|
|
* |
244
|
|
|
* @return Information |
245
|
|
|
*/ |
246
|
2 |
|
public function setProducers(array $producers): Information |
247
|
|
|
{ |
248
|
2 |
|
$this->producers = $producers; |
249
|
|
|
|
250
|
2 |
|
return $this; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* @param Producer $producer |
255
|
|
|
* |
256
|
|
|
* @return Information |
257
|
|
|
*/ |
258
|
1 |
|
public function addProducer(Producer $producer): Information |
259
|
|
|
{ |
260
|
1 |
|
$this->producers[] = $producer; |
261
|
|
|
|
262
|
1 |
|
return $this; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* @return Producer[] |
267
|
|
|
*/ |
268
|
2 |
|
public function getLicensees(): array |
269
|
|
|
{ |
270
|
2 |
|
return $this->licensees; |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
/** |
274
|
|
|
* @param Producer[] $licensees |
275
|
|
|
* |
276
|
|
|
* @return Information |
277
|
|
|
*/ |
278
|
2 |
|
public function setLicensees(array $licensees): Information |
279
|
|
|
{ |
280
|
2 |
|
$this->licensees = $licensees; |
281
|
|
|
|
282
|
2 |
|
return $this; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* @param Producer $licensee |
287
|
|
|
* |
288
|
|
|
* @return Information |
289
|
|
|
*/ |
290
|
1 |
|
public function addLicensee(Producer $licensee): Information |
291
|
|
|
{ |
292
|
1 |
|
$this->licensees[] = $licensee; |
293
|
|
|
|
294
|
1 |
|
return $this; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* @return Producer[] |
299
|
|
|
*/ |
300
|
2 |
|
public function getStudios(): array |
301
|
|
|
{ |
302
|
2 |
|
return $this->studios; |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
/** |
306
|
|
|
* @param Producer[] $studios |
307
|
|
|
* |
308
|
|
|
* @return Information |
309
|
|
|
*/ |
310
|
2 |
|
public function setStudios(array $studios): Information |
311
|
|
|
{ |
312
|
2 |
|
$this->studios = $studios; |
313
|
|
|
|
314
|
2 |
|
return $this; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @param Producer $studio |
319
|
|
|
* |
320
|
|
|
* @return Information |
321
|
|
|
*/ |
322
|
1 |
|
public function addStudio(Producer $studio): Information |
323
|
|
|
{ |
324
|
1 |
|
$this->studios[] = $studio; |
325
|
|
|
|
326
|
1 |
|
return $this; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* @return Source |
331
|
|
|
*/ |
332
|
2 |
|
public function getSource(): ?Source |
333
|
|
|
{ |
334
|
2 |
|
return $this->source; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* @param Source $source |
339
|
|
|
* |
340
|
|
|
* @return Information |
341
|
|
|
*/ |
342
|
2 |
|
public function setSource(Source $source): Information |
343
|
|
|
{ |
344
|
2 |
|
$this->source = $source; |
345
|
|
|
|
346
|
2 |
|
return $this; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
/** |
350
|
|
|
* @return Genre[] |
351
|
|
|
*/ |
352
|
2 |
|
public function getGenres(): array |
353
|
|
|
{ |
354
|
2 |
|
return $this->genres; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* @param Genre[] $genres |
359
|
|
|
* |
360
|
|
|
* @return Information |
361
|
|
|
*/ |
362
|
2 |
|
public function setGenres(array $genres): Information |
363
|
|
|
{ |
364
|
2 |
|
$this->genres = $genres; |
365
|
|
|
|
366
|
2 |
|
return $this; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
/** |
370
|
|
|
* @param Genre $genre |
371
|
|
|
* |
372
|
|
|
* @return Information |
373
|
|
|
*/ |
374
|
1 |
|
public function addGenre(Genre $genre): Information |
375
|
|
|
{ |
376
|
1 |
|
$this->genres[] = $genre; |
377
|
|
|
|
378
|
1 |
|
return $this; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* @return string |
383
|
|
|
*/ |
384
|
2 |
|
public function getDuration(): ?string |
385
|
|
|
{ |
386
|
2 |
|
return $this->duration; |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* @param string $duration |
391
|
|
|
* |
392
|
|
|
* @return Information |
393
|
|
|
*/ |
394
|
2 |
|
public function setDuration(string $duration): Information |
395
|
|
|
{ |
396
|
2 |
|
$this->duration = $duration; |
397
|
|
|
|
398
|
2 |
|
return $this; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
/** |
402
|
|
|
* @return string |
403
|
|
|
*/ |
404
|
2 |
|
public function getRating(): ?string |
405
|
|
|
{ |
406
|
2 |
|
return $this->rating; |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
/** |
410
|
|
|
* @param string $rating |
411
|
|
|
* |
412
|
|
|
* @return Information |
413
|
|
|
*/ |
414
|
2 |
|
public function setRating(string $rating): Information |
415
|
|
|
{ |
416
|
2 |
|
$this->rating = $rating; |
417
|
|
|
|
418
|
2 |
|
return $this; |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
/** |
422
|
|
|
* @inheritDoc |
423
|
|
|
*/ |
424
|
1 |
|
public function jsonSerialize(): array |
425
|
|
|
{ |
426
|
|
|
return [ |
427
|
1 |
|
'type' => $this->getType(), |
428
|
1 |
|
'episodes' => $this->getEpisodes(), |
429
|
1 |
|
'status' => $this->getStatus(), |
430
|
1 |
|
'aired_from' => null !== $this->getAiredFrom() ? $this->getAiredFrom()->format('c') : null, |
431
|
1 |
|
'aired_to' => null !== $this->getAiredTo() ? $this->getAiredTo()->format('c') : null, |
432
|
1 |
|
'premiered' => $this->getPremiered(), |
433
|
1 |
|
'broadcast' => $this->getBroadcast(), |
434
|
1 |
|
'producers' => $this->getProducers(), |
435
|
1 |
|
'licensees' => $this->getLicensees(), |
436
|
1 |
|
'studios' => $this->getStudios(), |
437
|
1 |
|
'source' => $this->getSource(), |
438
|
1 |
|
'genres' => $this->getGenres(), |
439
|
1 |
|
'duration' => $this->getDuration(), |
440
|
1 |
|
'rating' => $this->getRating(), |
441
|
|
|
]; |
442
|
|
|
} |
443
|
|
|
} |