Completed
Pull Request — master (#146)
by Fabien
07:21
created

Stack::getClientRequest()   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 2
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
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
     * @param string $client
81
     * @param string $request
82
     */
83 10
    public function __construct($client, $request)
84
    {
85 10
        $this->client = $client;
86 10
        $this->request = $request;
87 10
    }
88
89
    /**
90
     * @return string
91
     */
92 1
    public function getClient()
93
    {
94 1
        return $this->client;
95
    }
96
97
    /**
98
     * @param Profile $profile
99
     */
100 4
    public function addProfile(Profile $profile)
101
    {
102 4
        $this->profiles[] = $profile;
103 4
    }
104
105
    /**
106
     * @return Profile[]
107
     */
108 2
    public function getProfiles()
109
    {
110 2
        return $this->profiles;
111
    }
112
113
    /**
114
     * @return string
115
     */
116 1
    public function getRequest()
117
    {
118 1
        return $this->request;
119
    }
120
121
    /**
122
     * @return string
123
     */
124 1
    public function getResponse()
125
    {
126 1
        return $this->response;
127
    }
128
129
    /**
130
     * @param string $response
131
     */
132 2
    public function setResponse($response)
133
    {
134 2
        $this->response = $response;
135 2
    }
136
137
    /**
138
     * @return bool
139
     */
140
    public function isFailed()
141
    {
142
        return $this->failed;
143
    }
144
145
    /**
146
     * @param bool $failed
147
     */
148 1
    public function setFailed($failed)
149
    {
150 1
        $this->failed = $failed;
151 1
    }
152
153
    /**
154
     * @return string
155
     */
156 2
    public function getRequestTarget()
157
    {
158 2
        return $this->requestTarget;
159
    }
160
161
    /**
162
     * @param string $requestTarget
163
     */
164 3
    public function setRequestTarget($requestTarget)
165
    {
166 3
        $this->requestTarget = $requestTarget;
167 3
    }
168
169
    /**
170
     * @return string
171
     */
172 2
    public function getRequestMethod()
173
    {
174 2
        return $this->requestMethod;
175
    }
176
177
    /**
178
     * @param string $requestMethod
179
     */
180 3
    public function setRequestMethod($requestMethod)
181
    {
182 3
        $this->requestMethod = $requestMethod;
183 3
    }
184
185
    /**
186
     * @return string
187
     */
188
    public function getClientRequest()
189
    {
190
        return $this->clientRequest;
191
    }
192
193
    /**
194
     * @param string $clientRequest
195
     */
196 3
    public function setClientRequest($clientRequest)
197
    {
198 3
        $this->clientRequest = $clientRequest;
199 3
    }
200
201
    /**
202
     * @return mixed
203
     */
204
    public function getClientResponse()
205
    {
206
        return $this->clientResponse;
207
    }
208
209
    /**
210
     * @param mixed $clientResponse
211
     */
212 2
    public function setClientResponse($clientResponse)
213
    {
214 2
        $this->clientResponse = $clientResponse;
215 2
    }
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 2
    public function setResponseCode($responseCode)
245
    {
246 2
        $this->responseCode = $responseCode;
247 2
    }
248
249
    /**
250
     * @return string
251
     */
252 2
    public function getRequestHost()
253
    {
254 2
        return $this->requestHost;
255
    }
256
257
    /**
258
     * @param string $requestHost
259
     */
260 3
    public function setRequestHost($requestHost)
261
    {
262 3
        $this->requestHost = $requestHost;
263 3
    }
264
265
    /**
266
     * @return string
267
     */
268 2
    public function getRequestScheme()
269
    {
270 2
        return $this->requestScheme;
271
    }
272
273
    /**
274
     * @param string $requestScheme
275
     */
276 3
    public function setRequestScheme($requestScheme)
277
    {
278 3
        $this->requestScheme = $requestScheme;
279 3
    }
280
}
281