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

AbstractResponse::setRateLimitRemaining()   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\Pexels\Traits\RateLimitTrait;
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
    use RateLimitTrait;
26
27
    /**
28
     * Medias.
29
     *
30
     * @var AbstractMedia[]
31
     */
32
    private $medias;
33
34
    /**
35
     * Raw response.
36
     *
37
     * @var string
38
     */
39
    private $rawResponse;
40
41
    /**
42
     * Constructor.
43
     */
44
    public function __construct() {
45
        $this->setMedias([]);
46
    }
47
48
    /**
49
     * Add a media.
50
     *
51
     * @param AbstractMedia $media The media.
52
     * @return AbstractResponse Returns this response.
53
     */
54
    protected function addMedia(AbstractMedia $media) {
55
        $this->medias[] = $media;
56
        return $this;
57
    }
58
59
    /**
60
     * Get the medias.
61
     *
62
     * @return AbstractMedia[] Returns the medias.
63
     */
64
    protected function getMedias() {
65
        return $this->medias;
66
    }
67
68
    /**
69
     * Get the raw response.
70
     *
71
     * @return string Returns the raw response.
72
     */
73
    public function getRawResponse() {
74
        return $this->rawResponse;
75
    }
76
77
    /**
78
     * Set the medias.
79
     *
80
     * @param AbstractMedia[] $medias The medias.
81
     * @return AbstractResponse Returns this response.
82
     */
83
    protected function setMedias(array $medias) {
84
        $this->medias = $medias;
85
        return $this;
86
    }
87
88
    /**
89
     * Set the raw response.
90
     *
91
     * @param string $rawResponse The raw response.
92
     * @return AbstractResponse Returns this response.
93
     */
94
    public function setRawResponse($rawResponse) {
95
        $this->rawResponse = $rawResponse;
96
        return $this;
97
    }
98
}
99