1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mechpave\ImgurClient\Entity; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class Image |
7
|
|
|
* @package Mechpave\ImgurClient\Entity |
8
|
|
|
*/ |
9
|
|
|
class Image implements ImageInterface |
10
|
|
|
{ |
11
|
|
|
|
12
|
|
|
//TODO: implement functions to get links to images in different sizes |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @var string |
16
|
|
|
*/ |
17
|
|
|
protected $imageId; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $title; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
protected $description; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var \DateTime |
31
|
|
|
*/ |
32
|
|
|
protected $uploadedAt; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected $type; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var bool |
41
|
|
|
*/ |
42
|
|
|
protected $animated; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var int |
46
|
|
|
*/ |
47
|
|
|
protected $width; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var int |
51
|
|
|
*/ |
52
|
|
|
protected $height; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var int |
56
|
|
|
*/ |
57
|
|
|
protected $size; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var int |
61
|
|
|
*/ |
62
|
|
|
protected $views; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var int |
66
|
|
|
*/ |
67
|
|
|
protected $bandwith; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
protected $deleteHash; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @var string |
76
|
|
|
*/ |
77
|
|
|
protected $name; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var string |
81
|
|
|
*/ |
82
|
|
|
protected $section; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @var string |
86
|
|
|
*/ |
87
|
|
|
protected $link; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @var string |
91
|
|
|
*/ |
92
|
|
|
protected $gifv; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @var string |
96
|
|
|
*/ |
97
|
|
|
protected $mp4; |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @var string |
101
|
|
|
*/ |
102
|
|
|
protected $webm; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @var bool |
106
|
|
|
*/ |
107
|
|
|
protected $looping; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @var bool |
111
|
|
|
*/ |
112
|
|
|
protected $favorite; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @var bool |
116
|
|
|
*/ |
117
|
|
|
protected $nsfw; |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @var string |
121
|
|
|
*/ |
122
|
|
|
protected $vote; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @param string $imageId |
126
|
|
|
* @return ImageInterface |
127
|
|
|
*/ |
128
|
1 |
|
public function setImageId($imageId) |
129
|
|
|
{ |
130
|
1 |
|
$this->imageId = $imageId; |
131
|
|
|
|
132
|
1 |
|
return $this; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return string |
137
|
|
|
*/ |
138
|
1 |
|
public function getImageId() |
139
|
|
|
{ |
140
|
1 |
|
return $this->imageId; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @param string $title |
145
|
|
|
* @return ImageInterface |
146
|
|
|
*/ |
147
|
1 |
|
public function setTitle($title) |
148
|
|
|
{ |
149
|
1 |
|
$this->title = $title; |
150
|
|
|
|
151
|
1 |
|
return $this; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @return string |
156
|
|
|
*/ |
157
|
1 |
|
public function getTitle() |
158
|
|
|
{ |
159
|
1 |
|
return $this->title; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @param string $description |
164
|
|
|
* @return ImageInterface |
165
|
|
|
*/ |
166
|
1 |
|
public function setDescription($description) |
167
|
|
|
{ |
168
|
1 |
|
$this->description = $description; |
169
|
|
|
|
170
|
1 |
|
return $this; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @return string |
175
|
|
|
*/ |
176
|
1 |
|
public function getDescription() |
177
|
|
|
{ |
178
|
1 |
|
return $this->description; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @param \DateTime $uploadedAt |
183
|
|
|
* @return ImageInterface |
184
|
|
|
*/ |
185
|
1 |
|
public function setUploadedAt($uploadedAt) |
186
|
|
|
{ |
187
|
1 |
|
$this->uploadedAt = $uploadedAt; |
188
|
|
|
|
189
|
1 |
|
return $this; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @return \DateTime |
194
|
|
|
*/ |
195
|
1 |
|
public function getUploadedAt() |
196
|
|
|
{ |
197
|
1 |
|
return $this->uploadedAt; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @param string $type |
202
|
|
|
* @return ImageInterface |
203
|
|
|
*/ |
204
|
1 |
|
public function setType($type) |
205
|
|
|
{ |
206
|
1 |
|
$this->type = $type; |
207
|
|
|
|
208
|
1 |
|
return $this; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return string |
213
|
|
|
*/ |
214
|
1 |
|
public function getType() |
215
|
|
|
{ |
216
|
1 |
|
return $this->type; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @param bool $animated |
221
|
|
|
* @return ImageInterface |
222
|
|
|
*/ |
223
|
1 |
|
public function setAnimated($animated) |
224
|
|
|
{ |
225
|
1 |
|
$this->animated = $animated; |
226
|
|
|
|
227
|
1 |
|
return $this; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* @return bool |
232
|
|
|
*/ |
233
|
1 |
|
public function isAnimated() |
234
|
|
|
{ |
235
|
1 |
|
return $this->animated; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @param int $width |
240
|
|
|
* @return ImageInterface |
241
|
|
|
*/ |
242
|
1 |
|
public function setWidth($width) |
243
|
|
|
{ |
244
|
1 |
|
$this->width = $width; |
245
|
|
|
|
246
|
1 |
|
return $this; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @return int |
251
|
|
|
*/ |
252
|
1 |
|
public function getWidth() |
253
|
|
|
{ |
254
|
1 |
|
return $this->width; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* @param int $height |
259
|
|
|
* @return ImageInterface |
260
|
|
|
*/ |
261
|
1 |
|
public function setHeight($height) |
262
|
|
|
{ |
263
|
1 |
|
$this->height = $height; |
264
|
|
|
|
265
|
1 |
|
return $this; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* @return int |
270
|
|
|
*/ |
271
|
1 |
|
public function getHeight() |
272
|
|
|
{ |
273
|
1 |
|
return $this->height; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* @param int $size |
278
|
|
|
* @return ImageInterface |
279
|
|
|
*/ |
280
|
1 |
|
public function setSize($size) |
281
|
|
|
{ |
282
|
1 |
|
$this->size = $size; |
283
|
|
|
|
284
|
1 |
|
return $this; |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* @return int |
289
|
|
|
*/ |
290
|
1 |
|
public function getSize() |
291
|
|
|
{ |
292
|
1 |
|
return $this->size; |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* @param int $views |
297
|
|
|
* @return ImageInterface |
298
|
|
|
*/ |
299
|
1 |
|
public function setViews($views) |
300
|
|
|
{ |
301
|
1 |
|
$this->views = $views; |
302
|
|
|
|
303
|
1 |
|
return $this; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* @return int |
308
|
|
|
*/ |
309
|
1 |
|
public function getViews() |
310
|
|
|
{ |
311
|
1 |
|
return $this->views; |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
/** |
315
|
|
|
* @param int $bandwith |
316
|
|
|
* @return ImageInterface |
317
|
|
|
*/ |
318
|
1 |
|
public function setBandwith($bandwith) |
319
|
|
|
{ |
320
|
1 |
|
$this->bandwith = $bandwith; |
321
|
|
|
|
322
|
1 |
|
return $this; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* @return int |
327
|
|
|
*/ |
328
|
1 |
|
public function getBandwith() |
329
|
|
|
{ |
330
|
1 |
|
return $this->bandwith; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* @param string $deleteHash |
335
|
|
|
* @return ImageInterface |
336
|
|
|
*/ |
337
|
1 |
|
public function setDeleteHash($deleteHash) |
338
|
|
|
{ |
339
|
1 |
|
$this->deleteHash = $deleteHash; |
340
|
|
|
|
341
|
1 |
|
return $this; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* @return string |
346
|
|
|
*/ |
347
|
1 |
|
public function getDeleteHash() |
348
|
|
|
{ |
349
|
1 |
|
return $this->deleteHash; |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* @param string $name |
354
|
|
|
* @return ImageInterface |
355
|
|
|
*/ |
356
|
1 |
|
public function setName($name) |
357
|
|
|
{ |
358
|
1 |
|
$this->name = $name; |
359
|
|
|
|
360
|
1 |
|
return $this; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* @return string |
365
|
|
|
*/ |
366
|
1 |
|
public function getName() |
367
|
|
|
{ |
368
|
1 |
|
return $this->name; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* @param string $section |
373
|
|
|
* @return ImageInterface |
374
|
|
|
*/ |
375
|
1 |
|
public function setSection($section) |
376
|
|
|
{ |
377
|
1 |
|
$this->section = $section; |
378
|
|
|
|
379
|
1 |
|
return $this; |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* @return string |
384
|
|
|
*/ |
385
|
1 |
|
public function getSection() |
386
|
|
|
{ |
387
|
1 |
|
return $this->section; |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* @param string $link |
392
|
|
|
* @return ImageInterface |
393
|
|
|
*/ |
394
|
1 |
|
public function setLink($link) |
395
|
|
|
{ |
396
|
1 |
|
$this->link = $link; |
397
|
|
|
|
398
|
1 |
|
return $this; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
/** |
402
|
|
|
* @return string |
403
|
|
|
*/ |
404
|
1 |
|
public function getLink() |
405
|
|
|
{ |
406
|
1 |
|
return $this->link; |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
/** |
410
|
|
|
* @param string $gifv |
411
|
|
|
* @return ImageInterface |
412
|
|
|
*/ |
413
|
1 |
|
public function setGifv($gifv) |
414
|
|
|
{ |
415
|
1 |
|
$this->gifv = $gifv; |
416
|
|
|
|
417
|
1 |
|
return $this; |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
/** |
421
|
|
|
* @return string |
422
|
|
|
*/ |
423
|
1 |
|
public function getGifv() |
424
|
|
|
{ |
425
|
1 |
|
return $this->gifv; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
/** |
429
|
|
|
* @param string $mp4 |
430
|
|
|
* @return ImageInterface |
431
|
|
|
*/ |
432
|
1 |
|
public function setMp4($mp4) |
433
|
|
|
{ |
434
|
1 |
|
$this->mp4 = $mp4; |
435
|
|
|
|
436
|
1 |
|
return $this; |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* @return string |
441
|
|
|
*/ |
442
|
1 |
|
public function getMp4() |
443
|
|
|
{ |
444
|
1 |
|
return $this->mp4; |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
/** |
448
|
|
|
* @param string $webm |
449
|
|
|
* @return ImageInterface |
450
|
|
|
*/ |
451
|
1 |
|
public function setWebm($webm) |
452
|
|
|
{ |
453
|
1 |
|
$this->webm = $webm; |
454
|
|
|
|
455
|
1 |
|
return $this; |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
/** |
459
|
|
|
* @return string |
460
|
|
|
*/ |
461
|
1 |
|
public function getWebm() |
462
|
|
|
{ |
463
|
1 |
|
return $this->webm; |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
/** |
467
|
|
|
* @param bool $looping |
468
|
|
|
* @return ImageInterface |
469
|
|
|
*/ |
470
|
1 |
|
public function setLooping($looping) |
471
|
|
|
{ |
472
|
1 |
|
$this->looping = $looping; |
473
|
|
|
|
474
|
1 |
|
return $this; |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
/** |
478
|
|
|
* @return bool |
479
|
|
|
*/ |
480
|
1 |
|
public function isLooping() |
481
|
|
|
{ |
482
|
1 |
|
return $this->looping; |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
/** |
486
|
|
|
* @param bool $favorite |
487
|
|
|
* @return ImageInterface |
488
|
|
|
*/ |
489
|
1 |
|
public function setFavorite($favorite) |
490
|
|
|
{ |
491
|
1 |
|
$this->favorite = $favorite; |
492
|
|
|
|
493
|
1 |
|
return $this; |
494
|
|
|
} |
495
|
|
|
|
496
|
|
|
/** |
497
|
|
|
* @return bool |
498
|
|
|
*/ |
499
|
1 |
|
public function isFavorite() |
500
|
|
|
{ |
501
|
1 |
|
return $this->favorite; |
502
|
|
|
} |
503
|
|
|
|
504
|
|
|
/** |
505
|
|
|
* @param bool $nsfw |
506
|
|
|
* @return ImageInterface |
507
|
|
|
*/ |
508
|
1 |
|
public function setNsfw($nsfw) |
509
|
|
|
{ |
510
|
1 |
|
$this->nsfw = $nsfw; |
511
|
|
|
|
512
|
1 |
|
return $this; |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
/** |
516
|
|
|
* @return bool |
517
|
|
|
*/ |
518
|
1 |
|
public function isNsfw() |
519
|
|
|
{ |
520
|
1 |
|
return $this->nsfw; |
521
|
|
|
} |
522
|
|
|
|
523
|
|
|
/** |
524
|
|
|
* @param string $vote |
525
|
|
|
* @return ImageInterface |
526
|
|
|
*/ |
527
|
1 |
|
public function setVote($vote) |
528
|
|
|
{ |
529
|
1 |
|
$this->vote = $vote; |
530
|
|
|
|
531
|
1 |
|
return $this; |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
/** |
535
|
|
|
* @return string |
536
|
|
|
*/ |
537
|
1 |
|
public function getVote() |
538
|
|
|
{ |
539
|
1 |
|
return $this->vote; |
540
|
|
|
} |
541
|
|
|
} |