|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace ProjetNormandie\TwitchBundle\Model\Twitch; |
|
6
|
|
|
|
|
7
|
|
|
use DateTime; |
|
8
|
|
|
|
|
9
|
|
|
class Stream implements \JsonSerializable |
|
10
|
|
|
{ |
|
11
|
|
|
private ?int $id = null; |
|
12
|
|
|
private string $username = ''; |
|
13
|
|
|
private string $gameId = ''; |
|
14
|
|
|
private string $gameName = ''; |
|
15
|
|
|
private string $type = ''; |
|
16
|
|
|
private string $title = ''; |
|
17
|
|
|
private string $viewerCount = ''; |
|
18
|
|
|
private ?DateTime $startedAt = null; |
|
19
|
|
|
private string $language = 'en'; |
|
20
|
|
|
private string $thumnailUrl = ''; |
|
21
|
|
|
private array $tagIds = []; |
|
22
|
|
|
private array $tags = []; |
|
23
|
|
|
private bool $isMature = true; |
|
24
|
|
|
|
|
25
|
|
|
public function getGameName(): string |
|
26
|
|
|
{ |
|
27
|
|
|
return $this->gameName; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function setGameName(string $gameName): void |
|
31
|
|
|
{ |
|
32
|
|
|
$this->gameName = $gameName; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function getId(): ?int |
|
36
|
|
|
{ |
|
37
|
|
|
return $this->id; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function setId(?int $id): void |
|
41
|
|
|
{ |
|
42
|
|
|
$this->id = $id; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function getUsername(): string |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->username; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function setUsername(string $username): void |
|
51
|
|
|
{ |
|
52
|
|
|
$this->username = $username; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function getGameId(): string |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->gameId; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function setGameId(string $gameId): void |
|
61
|
|
|
{ |
|
62
|
|
|
$this->gameId = $gameId; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function getType(): string |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->type; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function setType(string $type): void |
|
71
|
|
|
{ |
|
72
|
|
|
$this->type = $type; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function getTitle(): string |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->title; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function setTitle(string $title): void |
|
81
|
|
|
{ |
|
82
|
|
|
$this->title = $title; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function getViewerCount(): string |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->viewerCount; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public function setViewerCount(string $viewerCount): void |
|
91
|
|
|
{ |
|
92
|
|
|
$this->viewerCount = $viewerCount; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
public function getStartedAt(): ?DateTime |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->startedAt; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function setStartedAt(mixed $startedAt): void |
|
101
|
|
|
{ |
|
102
|
|
|
|
|
103
|
|
|
if (is_string($startedAt)) { |
|
104
|
|
|
$this->startedAt = new DateTime($startedAt); |
|
105
|
|
|
} else { |
|
106
|
|
|
$this->startedAt = $startedAt; |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public function getLanguage(): string |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->language; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
public function setLanguage(string $language): void |
|
116
|
|
|
{ |
|
117
|
|
|
$this->language = $language; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
public function getThumnailUrl(): string |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->thumnailUrl; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
public function setThumnailUrl(string $thumnailUrl): void |
|
126
|
|
|
{ |
|
127
|
|
|
$this->thumnailUrl = $thumnailUrl; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
public function getTagIds(): array |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->tagIds; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
public function setTagIds(array $tagIds): void |
|
136
|
|
|
{ |
|
137
|
|
|
$this->tagIds = $tagIds; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
public function getTags(): array |
|
141
|
|
|
{ |
|
142
|
|
|
return $this->tags; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
public function setTags(array $tags): void |
|
146
|
|
|
{ |
|
147
|
|
|
$this->tags = $tags; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
public function isMature(): bool |
|
151
|
|
|
{ |
|
152
|
|
|
return $this->isMature; |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
public function setIsMature(bool $isMature): void |
|
156
|
|
|
{ |
|
157
|
|
|
$this->isMature = $isMature; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
|
|
161
|
|
|
/** |
|
162
|
|
|
* @return array<mixed> |
|
163
|
|
|
*/ |
|
164
|
|
|
public function jsonSerialize(): array |
|
165
|
|
|
{ |
|
166
|
|
|
return [ |
|
167
|
|
|
'id' => $this->id, |
|
168
|
|
|
'user_name' => $this->username, |
|
169
|
|
|
'game_id' => $this->gameId, |
|
170
|
|
|
'game_name' => $this->gameName, |
|
171
|
|
|
'type' => $this->type, |
|
172
|
|
|
'title' => $this->title, |
|
173
|
|
|
'viewer_count' => $this->viewerCount, |
|
174
|
|
|
'started_at' => $this->startedAt !== null ?? $this->startedAt->format('Y-m-d H:i:s'), |
|
|
|
|
|
|
175
|
|
|
'language' => $this->language, |
|
176
|
|
|
'thumnail_url' => $this->thumnailUrl, |
|
177
|
|
|
'tag_ids' => $this->tagIds, |
|
178
|
|
|
'tags' => $this->tags, |
|
179
|
|
|
'is_mature' => $this->isMature, |
|
180
|
|
|
]; |
|
181
|
|
|
} |
|
182
|
|
|
} |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.