Completed
Push — master ( f90dd6...0a073f )
by WEBEWEB
05:01
created

VideoResponse   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getVideo() 0 4 2
A setVideo() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the pexels-library package.
5
 *
6
 * (c) 2019 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Pexels\Model\Response;
13
14
use WBW\Library\Pexels\Model\AbstractResponse;
15
use WBW\Library\Pexels\Model\Video;
16
17
/**
18
 * Video response.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Library\Pexels\Model\Response
22
 */
23
class VideoResponse extends AbstractResponse {
24
25
    /**
26
     * Get the video.
27
     *
28
     * @return Video Returns the video.
29
     */
30
    public function getVideo() {
31
        $medias = $this->getMedias();
32
        return 1 === count($medias) ? $medias[0] : null;
33
    }
34
35
    /**
36
     * Set the video.
37
     *
38
     * @param Video $video The video.
39
     * @return VideoResponse Returns this video response.
40
     */
41
    public function setVideo(Video $video) {
42
        return $this->setMedias([$video]);
43
    }
44
}
45