AbstractMediaResponse   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 8
c 2
b 1
f 0
dl 0
loc 45
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addMedia() 0 3 1
A setMedias() 0 3 1
A getMedias() 0 2 1
A __construct() 0 2 1
1
<?php
2
3
/*
4
 * This file is part of the pexels-library package.
5
 *
6
 * (c) 2021 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\Response;
13
14
use WBW\Library\Pexels\Model\AbstractMedia;
15
16
/**
17
 * Abstract media response.
18
 *
19
 * @author webeweb <https://github.com/webeweb>
20
 * @package WBW\Library\Pexels\Response
21
 * @abstract
22
 */
23
abstract class AbstractMediaResponse extends AbstractResponse {
24
25
    /**
26
     * Medias.
27
     *
28
     * @var AbstractMedia[]
29
     */
30
    private $medias;
31
32
    /**
33
     * Constructor.
34
     */
35
    public function __construct() {
36
        $this->setMedias([]);
37
    }
38
39
    /**
40
     * Add a media.
41
     *
42
     * @param AbstractMedia $media The media.
43
     * @return $this Returns this media response.
44
     */
45
    protected function addMedia(AbstractMedia $media): AbstractMediaResponse {
46
        $this->medias[] = $media;
47
        return $this;
48
    }
49
50
    /**
51
     * Get the medias.
52
     *
53
     * @return AbstractMedia[] Returns the medias.
54
     */
55
    protected function getMedias(): array {
56
        return $this->medias;
57
    }
58
59
    /**
60
     * Set the medias.
61
     *
62
     * @param AbstractMedia[] $medias The medias.
63
     * @return $this Returns this media response.
64
     */
65
    protected function setMedias(array $medias): AbstractMediaResponse {
66
        $this->medias = $medias;
67
        return $this;
68
    }
69
}
70