Passed
Push — master ( 842a6e...27be02 )
by WEBEWEB
48:36
created

AbstractResponse::setRawResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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;
13
14
use WBW\Library\Core\Model\Attribute\StringRawResponseTrait;
15
16
/**
17
 * Abstract response.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Library\Pexels\Model
21
 * @abstract
22
 */
23
abstract class AbstractResponse {
24
25 1
    use RateLimitTrait;
26 1
    use StringRawResponseTrait;
27
28
    /**
29
     * Medias.
30
     *
31
     * @var AbstractMedia[]
32
     */
33
    private $medias;
34
35
    /**
36
     * Constructor.
37
     */
38 90
    public function __construct() {
39 90
        $this->setMedias([]);
40 90
    }
41
42
    /**
43
     * Add a media.
44
     *
45
     * @param AbstractMedia $media The media.
46
     * @return AbstractResponse Returns this response.
47
     */
48 20
    protected function addMedia(AbstractMedia $media): AbstractResponse {
49 20
        $this->medias[] = $media;
50 20
        return $this;
51
    }
52
53
    /**
54
     * Get the medias.
55
     *
56
     * @return AbstractMedia[] Returns the medias.
57
     */
58 80
    protected function getMedias(): array {
59 80
        return $this->medias;
60
    }
61
62
    /**
63
     * Set the medias.
64
     *
65
     * @param AbstractMedia[] $medias The medias.
66
     * @return AbstractResponse Returns this response.
67
     */
68 90
    protected function setMedias(array $medias): AbstractResponse {
69 90
        $this->medias = $medias;
70 90
        return $this;
71
    }
72
}
73