Passed
Push — master ( e0fa92...e382f1 )
by Oss
02:09
created

Response::setHttpHeaders()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @category    Brownie/HttpClient
4
 * @author      Brownie <[email protected]>
5
 * @license     http://www.gnu.org/copyleft/lesser.html
6
 */
7
8
namespace Brownie\HttpClient;
9
10
/**
11
 * HTTP client response.
12
 */
13
class Response
14
{
15
16
    /**
17
     * Response body.
18
     *
19
     * @var string
20
     */
21
    private $responseBody;
22
23
    /**
24
     * HTTP response code.
25
     *
26
     * @var int
27
     */
28
    private $httpCode;
29
30
    /**
31
     * Request execution time.
32
     *
33
     * @var float
34
     */
35
    private $runtime;
36
37
    /**
38
     * Headers.
39
     *
40
     * @var Headers
41
     */
42
    private $headeres;
43
44
    /**
45
     * Sets response body.
46
     * Returns the current object.
47
     *
48
     * @param string    $responseBody   Response body.
49
     *
50
     * @return self
51
     */
52 4
    public function setBody($responseBody)
53
    {
54 4
        $this->responseBody = $responseBody;
55 4
        return $this;
56
    }
57
58
    /**
59
     * Sets HTTP response code.
60
     * Returns the current object.
61
     *
62
     * @param int   $httpCode   HTTP response code.
63
     *
64
     * @return self
65
     */
66 4
    public function setHttpCode($httpCode)
67
    {
68 4
        $this->httpCode = $httpCode;
69 4
        return $this;
70
    }
71
72
    /**
73
     * Sets request execution time.
74
     * Returns the current object.
75
     *
76
     * @param float     $runtime        Request execution time.
77
     *
78
     * @return self
79
     */
80 4
    public function setRuntime($runtime)
81
    {
82 4
        $this->runtime = $runtime;
83 4
        return $this;
84
    }
85
86
    /**
87
     * Sets the headers of the http response.
88
     * Returns the current object.
89
     *
90
     * @param Headers     $headers    Headers.
91
     *
92
     * @return self
93
     */
94 3
    public function setHttpHeaders(Headers $headers)
95
    {
96 3
        $this->headeres = $headers;
97 3
        return $this;
98
    }
99
100
    /**
101
     * Returns response body.
102
     *
103
     * @return string
104
     */
105 4
    public function getBody()
106
    {
107 4
        return $this->responseBody;
108
    }
109
110
    /**
111
     * Returns HTTP response code.
112
     *
113
     * @return int
114
     */
115 4
    public function getHttpCode()
116
    {
117 4
        return $this->httpCode;
118
    }
119
120
    /**
121
     * Returns request execution time.
122
     *
123
     * @return float
124
     */
125 4
    public function getRuntime()
126
    {
127 4
        return $this->runtime;
128
    }
129
130
    /**
131
     * Returns the headers of the http response.
132
     *
133
     * @return Headers
134
     */
135 3
    public function getHttpHeaders()
136
    {
137 3
        return $this->headeres;
138
    }
139
}
140