Completed
Pull Request — master (#158)
by Fabien
10:04
created

Stack::getProfiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

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