|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of the feed-io package. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) Alexandre Debril <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace FeedIo\Feed\Item; |
|
12
|
|
|
|
|
13
|
|
|
abstract class MediaContentMedium extends MediaConstant |
|
14
|
|
|
{ |
|
15
|
|
|
const Image = 1; |
|
16
|
|
|
const Audio = 2; |
|
17
|
|
|
const Video = 3; |
|
18
|
|
|
const Document = 4; |
|
19
|
|
|
const Executable = 5; |
|
20
|
|
|
|
|
21
|
|
|
const VALUES = array( |
|
22
|
|
|
"image" => MediaContentMedium::Image, |
|
23
|
|
|
"audio" => MediaContentMedium::Audio, |
|
24
|
|
|
"video" => MediaContentMedium::Video, |
|
25
|
|
|
"document" => MediaContentMedium::Document, |
|
26
|
|
|
"executable" => MediaContentMedium::Executable, |
|
27
|
|
|
); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
abstract class MediaContentExpression extends MediaConstant |
|
31
|
|
|
{ |
|
32
|
|
|
const Sample = 1; |
|
33
|
|
|
const Full = 2; |
|
34
|
|
|
const NonStop = 3; |
|
35
|
|
|
|
|
36
|
|
|
const VALUES = array( |
|
37
|
|
|
"sample" => MediaContentExpression::Sample, |
|
38
|
|
|
"full" => MediaContentExpression::Full, |
|
39
|
|
|
"nonstop" => MediaContentExpression::NonStop, |
|
40
|
|
|
); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
class MediaContent implements MediaContentInterface |
|
44
|
|
|
{ |
|
45
|
|
|
/** |
|
46
|
|
|
* @var int |
|
47
|
|
|
*/ |
|
48
|
|
|
protected $fileSize; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @var int |
|
52
|
|
|
*/ |
|
53
|
|
|
protected $bitrate; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @var int |
|
57
|
|
|
*/ |
|
58
|
|
|
protected $framerate; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @var float |
|
62
|
|
|
*/ |
|
63
|
|
|
protected $samplingrate; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @var int |
|
67
|
|
|
*/ |
|
68
|
|
|
protected $duration; |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @var int |
|
72
|
|
|
*/ |
|
73
|
|
|
protected $height; |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @var int |
|
77
|
|
|
*/ |
|
78
|
|
|
protected $width; |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @var string |
|
82
|
|
|
*/ |
|
83
|
|
|
protected $lang; |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @var int |
|
87
|
|
|
*/ |
|
88
|
|
|
protected $expression; |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @var int |
|
92
|
|
|
*/ |
|
93
|
|
|
protected $medium; |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* @var bool |
|
97
|
|
|
*/ |
|
98
|
|
|
protected $default = true; |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @return int |
|
102
|
|
|
*/ |
|
103
|
2 |
|
public function getFileSize() : ?int |
|
104
|
|
|
{ |
|
105
|
2 |
|
return $this->fileSize; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @param int $fileSize |
|
110
|
|
|
* @return MediaContentInterface |
|
111
|
|
|
*/ |
|
112
|
47 |
|
public function setFileSize(?int $fileSize) : MediaContentInterface |
|
113
|
|
|
{ |
|
114
|
47 |
|
$this->fileSize = $fileSize; |
|
115
|
|
|
|
|
116
|
47 |
|
return $this; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* @return int |
|
121
|
|
|
*/ |
|
122
|
2 |
|
public function getBitrate() : ?int |
|
123
|
|
|
{ |
|
124
|
2 |
|
return $this->bitrate; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* @param int $bitrate |
|
129
|
|
|
* @return MediaContentInterface |
|
130
|
|
|
*/ |
|
131
|
47 |
|
public function setBitrate(?int $bitrate) : MediaContentInterface |
|
132
|
|
|
{ |
|
133
|
47 |
|
$this->bitrate = $bitrate; |
|
134
|
|
|
|
|
135
|
47 |
|
return $this; |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* @return int |
|
140
|
|
|
*/ |
|
141
|
2 |
|
public function getFramerate() : ?int |
|
142
|
|
|
{ |
|
143
|
2 |
|
return $this->framerate; |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* @param int $framerate |
|
148
|
|
|
* @return MediaContentInterface |
|
149
|
|
|
*/ |
|
150
|
47 |
|
public function setFramerate(?int $framerate) : MediaContentInterface |
|
151
|
|
|
{ |
|
152
|
47 |
|
$this->framerate = $framerate; |
|
153
|
|
|
|
|
154
|
47 |
|
return $this; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* @return integer |
|
159
|
|
|
*/ |
|
160
|
2 |
|
public function getSamplingrate() : ?float |
|
161
|
|
|
{ |
|
162
|
2 |
|
return $this->samplingrate; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* @param float $samplingrate |
|
167
|
|
|
* @return MediaContentInterface |
|
168
|
|
|
*/ |
|
169
|
47 |
|
public function setSamplingrate(?float $samplingrate) : MediaContentInterface |
|
170
|
|
|
{ |
|
171
|
47 |
|
$this->samplingrate = $samplingrate; |
|
172
|
|
|
|
|
173
|
47 |
|
return $this; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* @return int |
|
178
|
|
|
*/ |
|
179
|
2 |
|
public function getDuration() : ?int |
|
180
|
|
|
{ |
|
181
|
2 |
|
return $this->duration; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* @param int $duration |
|
186
|
|
|
* @return MediaContentInterface |
|
187
|
|
|
*/ |
|
188
|
47 |
|
public function setDuration(?int $duration) : MediaContentInterface |
|
189
|
|
|
{ |
|
190
|
47 |
|
$this->duration = $duration; |
|
191
|
|
|
|
|
192
|
47 |
|
return $this; |
|
193
|
|
|
} |
|
194
|
|
|
|
|
195
|
|
|
/** |
|
196
|
|
|
* @return int |
|
197
|
|
|
*/ |
|
198
|
2 |
|
public function getHeight() : ?int |
|
199
|
|
|
{ |
|
200
|
2 |
|
return $this->height; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
/** |
|
204
|
|
|
* @param int $height |
|
205
|
|
|
* @return MediaContentInterface |
|
206
|
|
|
*/ |
|
207
|
47 |
|
public function setHeight(?int $height) : MediaContentInterface |
|
208
|
|
|
{ |
|
209
|
47 |
|
$this->height = $height; |
|
210
|
|
|
|
|
211
|
47 |
|
return $this; |
|
212
|
|
|
} |
|
213
|
|
|
|
|
214
|
|
|
/** |
|
215
|
|
|
* @return int |
|
216
|
|
|
*/ |
|
217
|
2 |
|
public function getWidth() : ?int |
|
218
|
|
|
{ |
|
219
|
2 |
|
return $this->width; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
/** |
|
223
|
|
|
* @param int $width |
|
224
|
|
|
* @return MediaContentInterface |
|
225
|
|
|
*/ |
|
226
|
47 |
|
public function setWidth(?int $width) : MediaContentInterface |
|
227
|
|
|
{ |
|
228
|
47 |
|
$this->width = $width; |
|
229
|
|
|
|
|
230
|
47 |
|
return $this; |
|
231
|
|
|
} |
|
232
|
|
|
|
|
233
|
|
|
/** |
|
234
|
|
|
* @return string |
|
235
|
|
|
*/ |
|
236
|
2 |
|
public function getLang() : ?string |
|
237
|
|
|
{ |
|
238
|
2 |
|
return $this->lang; |
|
239
|
|
|
} |
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* @param string $lang |
|
243
|
|
|
* @return MediaContentInterface |
|
244
|
|
|
*/ |
|
245
|
47 |
|
public function setLang(?string $lang) : MediaContentInterface |
|
246
|
|
|
{ |
|
247
|
47 |
|
$this->lang = $lang; |
|
248
|
|
|
|
|
249
|
47 |
|
return $this; |
|
250
|
|
|
} |
|
251
|
|
|
|
|
252
|
|
|
/** |
|
253
|
|
|
* @return int |
|
254
|
|
|
*/ |
|
255
|
2 |
|
public function getExpression() : ?int |
|
256
|
|
|
{ |
|
257
|
2 |
|
return $this->expression; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
/** |
|
261
|
|
|
* @param int $expression |
|
262
|
|
|
* @return MediaContentInterface |
|
263
|
|
|
*/ |
|
264
|
47 |
|
public function setExpression(?int $expression) : MediaContentInterface |
|
265
|
|
|
{ |
|
266
|
47 |
|
$this->expression = $expression; |
|
267
|
|
|
|
|
268
|
47 |
|
return $this; |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
/** |
|
272
|
|
|
* @return int |
|
273
|
|
|
*/ |
|
274
|
2 |
|
public function getMedium() : ?int |
|
275
|
|
|
{ |
|
276
|
2 |
|
return $this->medium; |
|
277
|
|
|
} |
|
278
|
|
|
|
|
279
|
|
|
/** |
|
280
|
|
|
* @param int $medium |
|
281
|
|
|
* @return MediaContentInterface |
|
282
|
|
|
*/ |
|
283
|
47 |
|
public function setMedium(?int $medium) : MediaContentInterface |
|
284
|
|
|
{ |
|
285
|
47 |
|
$this->medium = $medium; |
|
286
|
|
|
|
|
287
|
47 |
|
return $this; |
|
288
|
|
|
} |
|
289
|
|
|
|
|
290
|
|
|
/** |
|
291
|
|
|
* @return bool |
|
292
|
|
|
*/ |
|
293
|
2 |
|
public function isDefault() : bool |
|
294
|
|
|
{ |
|
295
|
2 |
|
return $this->default; |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
/** |
|
299
|
|
|
* @param bool $default |
|
300
|
|
|
* @return MediaContentInterface |
|
301
|
|
|
*/ |
|
302
|
1 |
|
public function setDefault(bool $default) : MediaContentInterface |
|
303
|
|
|
{ |
|
304
|
1 |
|
$this->default = $default; |
|
305
|
|
|
|
|
306
|
1 |
|
return $this; |
|
307
|
|
|
} |
|
308
|
|
|
} |
|
309
|
|
|
|