Completed
Pull Request — master (#257)
by Éloi
02:08
created

Media::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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 MediaConstant
14
{
15
    /**
16
     * @param string|null $value
17
     */
18 47
    public static function fromXML(?string $value) : ?int
19
    {
20 47
        return static::VALUES[$value ? strtolower($value) : $value] ?? null;
21
    }
22
}
23
24
abstract class MediaDescriptionType extends MediaConstant
25
{
26
    const Plain = 1;
27
    const HTML = 2;
28
29
    const VALUES = array(
30
        null => MediaDescriptionType::Plain,
31
        "plain" => MediaDescriptionType::Plain,
32
        "html" => MediaDescriptionType::HTML,
33
    );
34
}
35
36
abstract class MediaTitleType extends MediaConstant
37
{
38
    const Plain = 1;
39
    const HTML = 2;
40
41
    const VALUES = array(
42
        null => MediaTitleType::Plain,
43
        "plain" => MediaTitleType::Plain,
44
        "html" => MediaTitleType::HTML,
45
    );
46
}
47
48
49
class Media implements MediaInterface
50
{
51
    /**
52
     * @var string
53
     */
54
    protected $nodeName;
55
56
    /**
57
     * @var string
58
     */
59
    protected $type;
60
61
    /**
62
     * @var string
63
     */
64
    protected $url;
65
66
    /**
67
     * @var string
68
     */
69
    protected $length;
70
71
    /**
72
     * @var string
73
     */
74
    protected $title;
75
76
    /**
77
     * @var string
78
     */
79
    protected $description;
80
81
    /**
82
     * @var int
83
     */
84
    protected $rights;
85
86
    /**
87
     * @var int
88
     */
89
    protected $titleType;
90
91
    /**
92
     * @var int
93
     */
94
    protected $descriptionType;
95
96
    /**
97
     * @var array
98
     */
99
    protected $keywords = array();
100
101
    /**
102
     * @var array
103
     */
104
    protected $comments = array();
105
106
    /**
107
     * @var array
108
     */
109
    protected $responses = array();
110
111
    /**
112
     * @var array
113
     */
114
    protected $backlinks = array();
115
116
    /**
117
     * @var array
118
     */
119
    protected $credits = array();
120
121
    /**
122
     * @var array
123
     */
124
    protected $texts = array();
125
126
    /**
127
     * @var array
128
     */
129
    protected $prices = array();
130
131
    /**
132
     * @var array
133
     */
134
    protected $subTitles = array();
135
136
    /**
137
     * @var array
138
     */
139
    protected $scenes = array();
140
141
    /**
142
     * @var MediaContentInterface
143
     */
144
    protected $content;
145
146
    /**
147
     * @var MediaThumbnailInterface
148
     */
149
    protected $thumbnail;
150
151
    /**
152
     * @var MediaCategoryInterface
153
     */
154
    protected $category;
155
156
    /**
157
     * @var MediaHashInterface
158
     */
159
    protected $hash;
160
161
    /**
162
     * @var MediaEmbedInterface
163
     */
164
    protected $embed;
165
166
    /**
167
     * @var MediaLicenseInterface
168
     */
169
    protected $license;
170
171
    /**
172
     * @var MediaCommunityInterface
173
     */
174
    protected $community;
175
176
    /**
177
     * @var MediaRestrictionInterface
178
     */
179
    protected $restriction;
180
181
    /**
182
     * @var MediaRatingInterface
183
     */
184
    protected $rating;
185
186
    /**
187
     * @var MediaCopyrightInterface
188
     */
189
    protected $copyright;
190
191
    /**
192
     * @var MediaPlayerInterface
193
     */
194
    protected $player;
195
196
    /**
197
     * @var MediaStatusInterface
198
     */
199
    protected $status;
200
201
    /**
202
     * @var MediaPeerLinkInterface
203
     */
204
    protected $peerLink;
205
206
    /**
207
     * @return string
208
     */
209
    public function getNodeName() : string
210
    {
211
        return $this->nodeName;
212
    }
213
214
    /**
215
     * @param string $nodeName
216
     * @return MediaInterface
217
     */
218 51
    public function setNodeName(string $nodeName) : MediaInterface
219
    {
220 51
        $this->nodeName = $nodeName;
221
222 51
        return $this;
223
    }
224
225
    /**
226
     * @return string
227
     */
228 7
    public function getType() : ? string
229
    {
230 7
        return $this->type;
231
    }
232
233
    /**
234
     * @param  string $type
235
     * @return MediaInterface
236
     */
237 54
    public function setType(?string $type) : MediaInterface
238
    {
239 54
        $this->type = $type;
240
241 54
        return $this;
242
    }
243
244
    /**
245
     * @return string
246
     */
247 10
    public function getUrl() : ? string
248
    {
249 10
        return $this->url;
250
    }
251
252
    /**
253
     * @param  string $url
254
     * @return MediaInterface
255
     */
256 53
    public function setUrl(?string $url) : MediaInterface
257
    {
258 53
        $this->url = $url;
259
260 53
        return $this;
261
    }
262
263
    /**
264
     * @return string
265
     */
266 3
    public function getLength() : ? string
267
    {
268 3
        return $this->length;
269
    }
270
271
    /**
272
     * @param  string $length
273
     * @return MediaInterface
274
     */
275 6
    public function setLength(?string $length) : MediaInterface
276
    {
277 6
        $this->length = $length;
278
279 6
        return $this;
280
    }
281
282
    /**
283
     * @return string
284
     */
285 4
    public function getTitle() : ? string
286
    {
287 4
        return $this->title;
288
    }
289
290
    /**
291
     * @param  string $title
292
     * @return MediaInterface
293
     */
294 4
    public function setTitle(?string $title) : MediaInterface
295
    {
296 4
        $this->title = $title;
297
298 4
        return $this;
299
    }
300
301
    /**
302
     * @return string
303
     */
304 5
    public function getDescription() : ? string
305
    {
306 5
        return $this->description;
307
    }
308
309
    /**
310
     * @param  string $description
311
     * @return MediaInterface
312
     */
313 5
    public function setDescription(?string $description) : MediaInterface
314
    {
315 5
        $this->description = $description;
316
317 5
        return $this;
318
    }
319
320
    /**
321
     * @return string
322
     */
323 1
    public function getRights() : ?int
324
    {
325 1
        return $this->rights;
326
    }
327
328
    /**
329
     * @param  int $rights
330
     * @return MediaInterface
331
     */
332 1
    public function setRights(int $rights) : MediaInterface
333
    {
334 1
        $this->rights = $rights;
335
336 1
        return $this;
337
    }
338
339
    /**
340
     * @return int
341
     */
342 2
    public function getTitleType() : ?int
343
    {
344 2
        return $this->titleType;
345
    }
346
347
    /**
348
     * @param  int $titleType
349
     * @return MediaInterface
350
     */
351 4
    public function setTitleType(?int $titleType) : MediaInterface
352
    {
353 4
        $this->titleType = $titleType;
354
355 4
        return $this;
356
    }
357
358
359
    /**
360
     * @return int
361
     */
362 2
    public function getDescriptionType() : ?int
363
    {
364 2
        return $this->descriptionType;
365
    }
366
367
    /**
368
     * @param  int $descriptionType
369
     * @return MediaInterface
370
     */
371 5
    public function setDescriptionType(?int $descriptionType) : MediaInterface
372
    {
373 5
        $this->descriptionType = $descriptionType;
374
375 5
        return $this;
376
    }
377
378
    /**
379
     * @return array
380
     */
381 1
    public function getKeywords() : array
382
    {
383 1
        return $this->keywords;
384
    }
385
386
    /**
387
     * @param  array $keywords
388
     * @return MediaInterface
389
     */
390 1
    public function setKeywords(array $keywords) : MediaInterface
391
    {
392 1
        $this->keywords = $keywords;
393
394 1
        return $this;
395
    }
396
397
    /**
398
     * @return array
399
     */
400 2
    public function getComments() : array
401
    {
402 2
        return $this->comments;
403
    }
404
405
    /**
406
     * @param  array $comments
407
     * @return MediaInterface
408
     */
409 2
    public function setComments(array $comments) : MediaInterface
410
    {
411 2
        $this->comments = $comments;
412
413 2
        return $this;
414
    }
415
416
    /**
417
     * @return array
418
     */
419 2
    public function getResponses() : array
420
    {
421 2
        return $this->responses;
422
    }
423
424
    /**
425
     * @param  array $responses
426
     * @return MediaInterface
427
     */
428 2
    public function setResponses(array $responses) : MediaInterface
429
    {
430 2
        $this->responses = $responses;
431
432 2
        return $this;
433
    }
434
435
    /**
436
     * @return array
437
     */
438 2
    public function getBacklinks() : array
439
    {
440 2
        return $this->backlinks;
441
    }
442
443
    /**
444
     * @param  array $backlinks
445
     * @return MediaInterface
446
     */
447 2
    public function setBacklinks(array $backlinks) : MediaInterface
448
    {
449 2
        $this->backlinks = $backlinks;
450
451 2
        return $this;
452
    }
453
454
    /**
455
     * @return array
456
     */
457 2
    public function getCredits() : array
458
    {
459 2
        return $this->credits;
460
    }
461
462
    /**
463
     * @param  array $credits
464
     * @return MediaInterface
465
     */
466 2
    public function setCredits(array $credits) : MediaInterface
467
    {
468 2
        $this->credits = $credits;
469
470 2
        return $this;
471
    }
472
473
    /**
474
     * @return array
475
     */
476 2
    public function getTexts() : array
477
    {
478 2
        return $this->texts;
479
    }
480
481
    /**
482
     * @param  array $texts
483
     * @return MediaInterface
484
     */
485 2
    public function setTexts(array $texts) : MediaInterface
486
    {
487 2
        $this->texts = $texts;
488
489 2
        return $this;
490
    }
491
492
    /**
493
     * @return array
494
     */
495 2
    public function getPrices() : array
496
    {
497 2
        return $this->prices;
498
    }
499
500
    /**
501
     * @param  array $prices
502
     * @return MediaInterface
503
     */
504 2
    public function setPrices(array $prices) : MediaInterface
505
    {
506 2
        $this->prices = $prices;
507
508 2
        return $this;
509
    }
510
511
    /**
512
     * @return array
513
     */
514 1
    public function getSubTitles() : array
515
    {
516 1
        return $this->subTitles;
517
    }
518
519
    /**
520
     * @param  array $subTitles
521
     * @return MediaInterface
522
     */
523 1
    public function setSubTitles(array $subTitles) : MediaInterface
524
    {
525 1
        $this->subTitles = $subTitles;
526
527 1
        return $this;
528
    }
529
530
    /**
531
     * @return array
532
     */
533 1
    public function getScenes() : array
534
    {
535 1
        return $this->scenes;
536
    }
537
538
    /**
539
     * @param  array $scenes
540
     * @return MediaInterface
541
     */
542 1
    public function setScenes(array $scenes) : MediaInterface
543
    {
544 1
        $this->scenes = $scenes;
545
546 1
        return $this;
547
    }
548
549
    /**
550
     * @return MediaContentInterface
551
     */
552 2
    public function getContent() : MediaContentInterface
553
    {
554 2
        return $this->content;
555
    }
556
557
    /**
558
     * @param  MediaContentInterface $content
559
     * @return MediaInterface
560
     */
561 47
    public function setContent(MediaContentInterface $content) : MediaInterface
562
    {
563 47
        $this->content = $content;
564
565 47
        return $this;
566
    }
567
568
    /**
569
     * @return MediaThumbnailInterface
570
     */
571 3
    public function getThumbnail() : MediaThumbnailInterface
572
    {
573 3
        return $this->thumbnail;
574
    }
575
576
    /**
577
     * @param  MediaThumbnailInterface $thumbnail
578
     * @return MediaInterface
579
     */
580 3
    public function setThumbnail(MediaThumbnailInterface $thumbnail) : MediaInterface
581
    {
582 3
        $this->thumbnail = $thumbnail;
583
584 3
        return $this;
585
    }
586
587
    /**
588
     * @return MediaCategoryInterface
589
     */
590 2
    public function getCategory() : MediaCategoryInterface
591
    {
592 2
        return $this->category;
593
    }
594
595
    /**
596
     * @param  MediaCategoryInterface $category
597
     * @return MediaInterface
598
     */
599 2
    public function setCategory(MediaCategoryInterface $category) : MediaInterface
600
    {
601 2
        $this->category = $category;
602
603 2
        return $this;
604
    }
605
606
    /**
607
     * @return MediaPlayerInterface
608
     */
609 2
    public function getPlayer() : MediaPlayerInterface
610
    {
611 2
        return $this->player;
612
    }
613
614
    /**
615
     * @param  MediaPlayerInterface $player
616
     * @return MediaInterface
617
     */
618 2
    public function setPlayer(MediaPlayerInterface $player) : MediaInterface
619
    {
620 2
        $this->player = $player;
621
622 2
        return $this;
623
    }
624
625
    /**
626
     * @return MediaHashInterface
627
     */
628 2
    public function getHash() : MediaHashInterface
629
    {
630 2
        return $this->hash;
631
    }
632
633
    /**
634
     * @param  MediaHashInterface $hash
635
     * @return MediaInterface
636
     */
637 2
    public function setHash(MediaHashInterface $hash) : MediaInterface
638
    {
639 2
        $this->hash = $hash;
640
641 2
        return $this;
642
    }
643
644
    /**
645
     * @return MediaEmbedInterface
646
     */
647 2
    public function getEmbed() : MediaEmbedInterface
648
    {
649 2
        return $this->embed;
650
    }
651
652
    /**
653
     * @param  MediaEmbedInterface $embed
654
     * @return MediaInterface
655
     */
656 2
    public function setEmbed(MediaEmbedInterface $embed) : MediaInterface
657
    {
658 2
        $this->embed = $embed;
659
660 2
        return $this;
661
    }
662
663
    /**
664
     * @return MediaLicenseInterface
665
     */
666 1
    public function getLicense() : MediaLicenseInterface
667
    {
668 1
        return $this->license;
669
    }
670
671
    /**
672
     * @param  MediaLicenseInterface $license
673
     * @return MediaInterface
674
     */
675 1
    public function setLicense(MediaLicenseInterface $license) : MediaInterface
676
    {
677 1
        $this->license = $license;
678
679 1
        return $this;
680
    }
681
682
    /**
683
     * @return MediaCommunityInterface
684
     */
685 2
    public function getCommunity() : MediaCommunityInterface
686
    {
687 2
        return $this->community;
688
    }
689
690
    /**
691
     * @param  MediaCommunityInterface $community
692
     * @return MediaInterface
693
     */
694 3
    public function setCommunity(MediaCommunityInterface $community) : MediaInterface
695
    {
696 3
        $this->community = $community;
697
698 3
        return $this;
699
    }
700
701
    /**
702
     * @return MediaRestrictionInterface
703
     */
704 2
    public function getRestriction() : MediaRestrictionInterface
705
    {
706 2
        return $this->restriction;
707
    }
708
709
    /**
710
     * @param  MediaRestrictionInterface $restriction
711
     * @return MediaInterface
712
     */
713 2
    public function setRestriction(MediaRestrictionInterface $restriction) : MediaInterface
714
    {
715 2
        $this->restriction = $restriction;
716
717 2
        return $this;
718
    }
719
720
    /**
721
     * @return MediaRatingInterface
722
     */
723 2
    public function getRating() : MediaRatingInterface
724
    {
725 2
        return $this->rating;
726
    }
727
728
    /**
729
     * @param  MediaRatingInterface $rating
730
     * @return MediaInterface
731
     */
732 2
    public function setRating(MediaRatingInterface $rating) : MediaInterface
733
    {
734 2
        $this->rating = $rating;
735
736 2
        return $this;
737
    }
738
739
    /**
740
     * @return MediaCopyrightInterface
741
     */
742 2
    public function getCopyright() : MediaCopyrightInterface
743
    {
744 2
        return $this->copyright;
745
    }
746
747
    /**
748
     * @param  MediaCopyrightInterface $copyright
749
     * @return MediaInterface
750
     */
751 2
    public function setCopyright(MediaCopyrightInterface $copyright) : MediaInterface
752
    {
753 2
        $this->copyright = $copyright;
754
755 2
        return $this;
756
    }
757
758
    /**
759
     * @return MediaStatusInterface
760
     */
761 2
    public function getStatus() : MediaStatusInterface
762
    {
763 2
        return $this->status;
764
    }
765
766
    /**
767
     * @param  MediaStatusInterface $status
768
     * @return MediaInterface
769
     */
770 2
    public function setStatus(MediaStatusInterface $status) : MediaInterface
771
    {
772 2
        $this->status = $status;
773
774 2
        return $this;
775
    }
776
777
    /**
778
     * @return MediaPeerLinkInterface
779
     */
780 1
    public function getPeerLink() : MediaPeerLinkInterface
781
    {
782 1
        return $this->peerLink;
783
    }
784
785
    /**
786
     * @param  MediaPeerLinkInterface $peerLink
787
     * @return MediaInterface
788
     */
789 1
    public function setPeerLink(MediaPeerLinkInterface $peerLink) : MediaInterface
790
    {
791 1
        $this->peerLink = $peerLink;
792
793 1
        return $this;
794
    }
795
}
796