1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace JiraRestApi\Configuration; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class AbstractConfiguration. |
7
|
|
|
*/ |
8
|
|
|
abstract class AbstractConfiguration implements ConfigurationInterface |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Jira host. |
12
|
|
|
* |
13
|
|
|
* @var string |
14
|
|
|
*/ |
15
|
|
|
protected $jiraHost; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Jira login. |
19
|
|
|
* |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $jiraUser; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Jira password. |
26
|
|
|
* |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $jiraPassword; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Enabled write to log. |
33
|
|
|
* |
34
|
|
|
* @var bool |
35
|
|
|
*/ |
36
|
|
|
protected $jiraLogEnabled; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Path to log file. |
40
|
|
|
* |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
protected $jiraLogFile; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Log level (DEBUG, INFO, ERROR, WARNING). |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
protected $jiraLogLevel; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Curl options CURLOPT_SSL_VERIFYHOST. |
54
|
|
|
* |
55
|
|
|
* @var bool |
56
|
|
|
*/ |
57
|
|
|
protected $curlOptSslVerifyHost; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Curl options CURLOPT_SSL_VERIFYPEER. |
61
|
|
|
* |
62
|
|
|
* @var bool |
63
|
|
|
*/ |
64
|
|
|
protected $curlOptSslVerifyPeer; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Curl option CURLOPT_USERAGENT. |
68
|
|
|
* |
69
|
|
|
* @var string |
70
|
|
|
*/ |
71
|
|
|
protected $curlOptUserAgent; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Curl options CURLOPT_VERBOSE. |
75
|
|
|
* |
76
|
|
|
* @var bool |
77
|
|
|
*/ |
78
|
|
|
protected $curlOptVerbose; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* HTTP header 'Authorization: Bearer {token}' for OAuth. |
82
|
|
|
* |
83
|
|
|
* @var string |
84
|
|
|
*/ |
85
|
|
|
protected $oauthAccessToken; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* enable cookie authorization. |
89
|
|
|
* |
90
|
|
|
* @var bool |
91
|
|
|
*/ |
92
|
|
|
protected $cookieAuthEnabled; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* HTTP cookie file name. |
96
|
|
|
* |
97
|
|
|
* @var string |
98
|
|
|
*/ |
99
|
|
|
protected $cookieFile; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Proxy server. |
103
|
|
|
* |
104
|
|
|
* @var string |
105
|
|
|
*/ |
106
|
|
|
protected $proxyServer; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Proxy port. |
110
|
|
|
* |
111
|
|
|
* @var string |
112
|
|
|
*/ |
113
|
|
|
protected $proxyPort; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Proxy user. |
117
|
|
|
* |
118
|
|
|
* @var string |
119
|
|
|
*/ |
120
|
|
|
protected $proxyUser; |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Proxy password. |
124
|
|
|
* |
125
|
|
|
* @var string |
126
|
|
|
*/ |
127
|
|
|
protected $proxyPassword; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @return string |
131
|
|
|
*/ |
132
|
|
|
public function getJiraHost() |
133
|
|
|
{ |
134
|
|
|
return $this->jiraHost; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @return string |
139
|
|
|
*/ |
140
|
|
|
public function getJiraUser() |
141
|
|
|
{ |
142
|
|
|
return $this->jiraUser; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @return string |
147
|
|
|
*/ |
148
|
|
|
public function getJiraPassword() |
149
|
|
|
{ |
150
|
|
|
return $this->jiraPassword; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @return bool |
155
|
|
|
*/ |
156
|
|
|
public function getJiraLogEnabled() |
157
|
|
|
{ |
158
|
|
|
return $this->jiraLogEnabled; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @return string |
163
|
|
|
*/ |
164
|
|
|
public function getJiraLogFile() |
165
|
|
|
{ |
166
|
|
|
return $this->jiraLogFile; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @return string |
171
|
|
|
*/ |
172
|
|
|
public function getJiraLogLevel() |
173
|
|
|
{ |
174
|
|
|
return $this->jiraLogLevel; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @return bool |
179
|
|
|
*/ |
180
|
|
|
public function isCurlOptSslVerifyHost() |
181
|
|
|
{ |
182
|
|
|
return $this->curlOptSslVerifyHost; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @return bool |
187
|
|
|
*/ |
188
|
|
|
public function isCurlOptSslVerifyPeer() |
189
|
|
|
{ |
190
|
|
|
return $this->curlOptSslVerifyPeer; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @return bool |
195
|
|
|
*/ |
196
|
|
|
public function isCurlOptVerbose() |
197
|
|
|
{ |
198
|
|
|
return $this->curlOptVerbose; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* Get curl option CURLOPT_USERAGENT. |
203
|
|
|
* |
204
|
|
|
* @return string |
205
|
|
|
*/ |
206
|
|
|
public function getCurlOptUserAgent() |
207
|
|
|
{ |
208
|
|
|
return $this->curlOptUserAgent; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return string |
213
|
|
|
*/ |
214
|
|
|
public function getOAuthAccessToken() |
215
|
|
|
{ |
216
|
|
|
return $this->oauthAccessToken; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @return string |
221
|
|
|
*/ |
222
|
|
|
public function isCookieAuthorizationEnabled() |
223
|
|
|
{ |
224
|
|
|
return $this->cookieAuthEnabled; |
|
|
|
|
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* get default User-Agent String. |
229
|
|
|
* |
230
|
|
|
* @return string |
231
|
|
|
*/ |
232
|
|
|
public function getDefaultUserAgentString() |
233
|
|
|
{ |
234
|
|
|
$curlVersion = curl_version(); |
235
|
|
|
|
236
|
|
|
return sprintf('curl/%s (%s)', $curlVersion['version'], $curlVersion['host']); |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @return string |
241
|
|
|
*/ |
242
|
|
|
public function getCookieFile() |
243
|
|
|
{ |
244
|
|
|
return $this->cookieFile; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* @return string |
249
|
|
|
*/ |
250
|
|
|
public function getProxyServer() |
251
|
|
|
{ |
252
|
|
|
return $this->proxyServer; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* @return string |
257
|
|
|
*/ |
258
|
|
|
public function getProxyPort() |
259
|
|
|
{ |
260
|
|
|
return $this->proxyPort; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* @return string |
265
|
|
|
*/ |
266
|
|
|
public function getProxyUser() |
267
|
|
|
{ |
268
|
|
|
return $this->proxyUser; |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* @return string |
273
|
|
|
*/ |
274
|
|
|
public function getProxyPassword() |
275
|
|
|
{ |
276
|
|
|
return $this->proxyPassword; |
277
|
|
|
} |
278
|
|
|
} |
279
|
|
|
|