Completed
Pull Request — master (#146)
by Fabien
10:17
created

Stack::getResponseCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Http\HttplugBundle\Collector;
4
5
/**
6
 * A Stack hold a collection of Profile to track the whole request execution.
7
 *
8
 * @author Fabien Bourigault <[email protected]>
9
 *
10
 * @internal
11
 */
12
final class Stack
13
{
14
    /**
15
     * @var string
16
     */
17
    private $client;
18
19
    /**
20
     * @var Profile[]
21
     */
22
    private $profiles = [];
23
24
    /**
25
     * @var string
26
     */
27
    private $request;
28
29
    /**
30
     * @var string
31
     */
32
    private $response;
33
34
    /**
35
     * @var bool
36
     */
37
    private $failed = false;
38
39
    /**
40
     * @var string
41
     */
42
    private $requestTarget;
43
44
    /**
45
     * @var string
46
     */
47
    private $requestMethod;
48
49
    /**
50
     * @var string
51
     */
52
    private $requestHost;
53 10
54
    /**
55 10
     * @var string
56 10
     */
57 10
    private $requestScheme;
58
59
    /**
60
     * @var string
61
     */
62 1
    private $clientRequest;
63
64 1
    /**
65
     * @var string
66
     */
67
    private $clientResponse;
68
69
    /**
70 4
     * @var string
71
     */
72 4
    private $clientException;
73 4
74
    /**
75
     * @var int
76
     */
77
    private $responseCode;
78 2
79
    /**
80 2
     * @param string $client
81
     * @param string $request
82
     */
83
    public function __construct($client, $request)
84
    {
85
        $this->client = $client;
86 1
        $this->request = $request;
87
    }
88 1
89
    /**
90
     * @return string
91
     */
92
    public function getClient()
93
    {
94 1
        return $this->client;
95
    }
96 1
97
    /**
98
     * @param Profile $profile
99
     */
100
    public function addProfile(Profile $profile)
101
    {
102 2
        $this->profiles[] = $profile;
103
    }
104 2
105 2
    /**
106
     * @return Profile[]
107
     */
108
    public function getProfiles()
109
    {
110
        return $this->profiles;
111
    }
112
113
    /**
114
     * @return string
115
     */
116
    public function getRequest()
117
    {
118 1
        return $this->request;
119
    }
120 1
121 1
    /**
122
     * @return string
123
     */
124
    public function getResponse()
125
    {
126 2
        return $this->response;
127
    }
128 2
129
    /**
130
     * @param string $response
131
     */
132
    public function setResponse($response)
133
    {
134 3
        $this->response = $response;
135
    }
136 3
137 3
    /**
138
     * @return bool
139
     */
140
    public function isFailed()
141
    {
142 2
        return $this->failed;
143
    }
144 2
145
    /**
146
     * @param bool $failed
147
     */
148
    public function setFailed($failed)
149
    {
150 3
        $this->failed = $failed;
151
    }
152 3
153 3
    /**
154
     * @return string
155
     */
156
    public function getRequestTarget()
157
    {
158
        return $this->requestTarget;
159
    }
160
161
    /**
162
     * @param string $requestTarget
163
     */
164
    public function setRequestTarget($requestTarget)
165
    {
166
        $this->requestTarget = $requestTarget;
167
    }
168
169
    /**
170
     * @return string
171
     */
172
    public function getRequestMethod()
173
    {
174
        return $this->requestMethod;
175
    }
176
177
    /**
178
     * @param string $requestMethod
179
     */
180
    public function setRequestMethod($requestMethod)
181
    {
182
        $this->requestMethod = $requestMethod;
183
    }
184
185
    /**
186
     * @return string
187
     */
188
    public function getClientRequest()
189
    {
190
        return $this->clientRequest;
191
    }
192
193
    /**
194
     * @param string $clientRequest
195
     */
196
    public function setClientRequest($clientRequest)
197
    {
198
        $this->clientRequest = $clientRequest;
199
    }
200
201
    /**
202
     * @return mixed
203
     */
204
    public function getClientResponse()
205
    {
206
        return $this->clientResponse;
207
    }
208
209
    /**
210
     * @param mixed $clientResponse
211
     */
212
    public function setClientResponse($clientResponse)
213
    {
214
        $this->clientResponse = $clientResponse;
215
    }
216
217
    /**
218
     * @return string
219
     */
220
    public function getClientException()
221
    {
222
        return $this->clientException;
223
    }
224
225
    /**
226
     * @param string $clientException
227
     */
228
    public function setClientException($clientException)
229
    {
230
        $this->clientException = $clientException;
231
    }
232
233
    /**
234
     * @return int
235
     */
236
    public function getResponseCode()
237
    {
238
        return $this->responseCode;
239
    }
240
241
    /**
242
     * @param int $responseCode
243
     */
244
    public function setResponseCode($responseCode)
245
    {
246
        $this->responseCode = $responseCode;
247
    }
248
249
    /**
250
     * @return string
251
     */
252
    public function getRequestHost()
253
    {
254
        return $this->requestHost;
255
    }
256
257
    /**
258
     * @param string $requestHost
259
     */
260
    public function setRequestHost($requestHost)
261
    {
262
        $this->requestHost = $requestHost;
263
    }
264
265
    /**
266
     * @return string
267
     */
268
    public function getRequestScheme()
269
    {
270
        return $this->requestScheme;
271
    }
272
273
    /**
274
     * @param string $requestScheme
275
     */
276
    public function setRequestScheme($requestScheme)
277
    {
278
        $this->requestScheme = $requestScheme;
279
    }
280
}
281