Completed
Push — master ( 7447f5...b893a1 )
by Fabien
04:06
created

Stack::getRequestTarget()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
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
54
    /**
55
     * @var string
56
     */
57
    private $requestScheme;
58
59
    /**
60
     * @var string
61
     */
62
    private $clientRequest;
63
64
    /**
65
     * @var string
66
     */
67
    private $clientResponse;
68
69
    /**
70
     * @var string
71
     */
72
    private $clientException;
73
74
    /**
75
     * @var int
76
     */
77
    private $responseCode;
78
79
    /**
80
     * @var int
81
     */
82
    private $duration = 0;
83
84
    /**
85
     * @var string
86
     */
87
    private $curlCommand;
88
89
    /**
90
     * @param string $client
91
     * @param string $request
92
     */
93 14
    public function __construct($client, $request)
94
    {
95 14
        $this->client = $client;
96 14
        $this->request = $request;
97 14
    }
98
99
    /**
100
     * @return string
101
     */
102 1
    public function getClient()
103
    {
104 1
        return $this->client;
105
    }
106
107
    /**
108
     * @param Profile $profile
109
     */
110 8
    public function addProfile(Profile $profile)
111
    {
112 8
        $this->profiles[] = $profile;
113 8
    }
114
115
    /**
116
     * @return Profile[]
117
     */
118 4
    public function getProfiles()
119
    {
120 4
        return $this->profiles;
121
    }
122
123
    /**
124
     * @return string
125
     */
126 1
    public function getRequest()
127
    {
128 1
        return $this->request;
129
    }
130
131
    /**
132
     * @return string
133
     */
134 1
    public function getResponse()
135
    {
136 1
        return $this->response;
137
    }
138
139
    /**
140
     * @param string $response
141
     */
142 5
    public function setResponse($response)
143
    {
144 5
        $this->response = $response;
145 5
    }
146
147
    /**
148
     * @return bool
149
     */
150
    public function isFailed()
151
    {
152
        return $this->failed;
153
    }
154
155
    /**
156
     * @param bool $failed
157
     */
158 1
    public function setFailed($failed)
159
    {
160 1
        $this->failed = $failed;
161 1
    }
162
163
    /**
164
     * @return string
165
     */
166 10
    public function getRequestTarget()
167
    {
168 10
        return $this->requestTarget;
169
    }
170
171
    /**
172
     * @param string $requestTarget
173
     */
174 11
    public function setRequestTarget($requestTarget)
175
    {
176 11
        $this->requestTarget = $requestTarget;
177 11
    }
178
179
    /**
180
     * @return string
181
     */
182 10
    public function getRequestMethod()
183
    {
184 10
        return $this->requestMethod;
185
    }
186
187
    /**
188
     * @param string $requestMethod
189
     */
190 11
    public function setRequestMethod($requestMethod)
191
    {
192 11
        $this->requestMethod = $requestMethod;
193 11
    }
194
195
    /**
196
     * @return string
197
     */
198 8
    public function getClientRequest()
199
    {
200 8
        return $this->clientRequest;
201
    }
202
203
    /**
204
     * @param string $clientRequest
205
     */
206 11
    public function setClientRequest($clientRequest)
207
    {
208 11
        $this->clientRequest = $clientRequest;
209 11
    }
210
211
    /**
212
     * @return mixed
213
     */
214
    public function getClientResponse()
215
    {
216
        return $this->clientResponse;
217
    }
218
219
    /**
220
     * @param mixed $clientResponse
221
     */
222 5
    public function setClientResponse($clientResponse)
223
    {
224 5
        $this->clientResponse = $clientResponse;
225 5
    }
226
227
    /**
228
     * @return string
229
     */
230
    public function getClientException()
231
    {
232
        return $this->clientException;
233
    }
234
235
    /**
236
     * @param string $clientException
237
     */
238
    public function setClientException($clientException)
239
    {
240
        $this->clientException = $clientException;
241
    }
242
243
    /**
244
     * @return int
245
     */
246
    public function getResponseCode()
247
    {
248
        return $this->responseCode;
249
    }
250
251
    /**
252
     * @param int $responseCode
253
     */
254 5
    public function setResponseCode($responseCode)
255
    {
256 5
        $this->responseCode = $responseCode;
257 5
    }
258
259
    /**
260
     * @return string
261
     */
262 10
    public function getRequestHost()
263
    {
264 10
        return $this->requestHost;
265
    }
266
267
    /**
268
     * @param string $requestHost
269
     */
270 11
    public function setRequestHost($requestHost)
271
    {
272 11
        $this->requestHost = $requestHost;
273 11
    }
274
275
    /**
276
     * @return string
277
     */
278 10
    public function getRequestScheme()
279
    {
280 10
        return $this->requestScheme;
281
    }
282
283
    /**
284
     * @param string $requestScheme
285
     */
286 11
    public function setRequestScheme($requestScheme)
287
    {
288 11
        $this->requestScheme = $requestScheme;
289 11
    }
290
291
    /**
292
     * @return int
293
     */
294
    public function getDuration()
295
    {
296
        return $this->duration;
297
    }
298
299
    /**
300
     * @param int $duration
301
     */
302 5
    public function setDuration($duration)
303
    {
304 5
        $this->duration = $duration;
305 5
    }
306
307
    /**
308
     * @return string
309
     */
310 8
    public function getCurlCommand()
311
    {
312 8
        return $this->curlCommand;
313
    }
314
315
    /**
316
     * @param string $curlCommand
317
     */
318 11
    public function setCurlCommand($curlCommand)
319
    {
320 11
        $this->curlCommand = $curlCommand;
321 11
    }
322
}
323