|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace JiraRestApi\Project; |
|
4
|
|
|
|
|
5
|
|
|
use JiraRestApi\ClassSerialize; |
|
6
|
|
|
use JiraRestApi\JiraException; |
|
7
|
|
|
|
|
8
|
|
|
class Project implements \JsonSerializable |
|
9
|
|
|
{ |
|
10
|
|
|
use ClassSerialize; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* return only if Project query by key(not id). |
|
14
|
|
|
* |
|
15
|
|
|
* @var string |
|
16
|
|
|
*/ |
|
17
|
|
|
public $expand; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Project URI. |
|
21
|
|
|
* |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
public $self; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Project id. |
|
28
|
|
|
* |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
public $id; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Project key. |
|
35
|
|
|
* |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
public $key; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Project name. |
|
42
|
|
|
* |
|
43
|
|
|
* @var string |
|
44
|
|
|
*/ |
|
45
|
|
|
public $name; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* avatar URL. |
|
49
|
|
|
* |
|
50
|
|
|
* @var array |
|
51
|
|
|
*/ |
|
52
|
|
|
public $avatarUrls; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Project category. |
|
56
|
|
|
* |
|
57
|
|
|
* @var array |
|
58
|
|
|
*/ |
|
59
|
|
|
public $projectCategory; |
|
60
|
|
|
|
|
61
|
|
|
/** @var string|null */ |
|
62
|
|
|
public $description; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Project leader info. |
|
66
|
|
|
* |
|
67
|
|
|
* @var array |
|
68
|
|
|
*/ |
|
69
|
|
|
public $lead; |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* The account ID of the project lead. |
|
73
|
|
|
* |
|
74
|
|
|
* @var string |
|
75
|
|
|
*/ |
|
76
|
|
|
public $leadAccountId; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* ComponentList [\JiraRestApi\Project\Component]. |
|
80
|
|
|
* |
|
81
|
|
|
* @var \JiraRestApi\Project\Component[] |
|
82
|
|
|
*/ |
|
83
|
|
|
public $components; |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* IssueTypeList [\JiraRestApi\Issue\IssueType]. |
|
87
|
|
|
* |
|
88
|
|
|
* @var \JiraRestApi\Issue\IssueType[] |
|
89
|
|
|
*/ |
|
90
|
|
|
public $issueTypes; |
|
91
|
|
|
|
|
92
|
|
|
/** @var string|null */ |
|
93
|
|
|
public $assigneeType; |
|
94
|
|
|
|
|
95
|
|
|
/** @var array|null */ |
|
96
|
|
|
public $versions; |
|
97
|
|
|
|
|
98
|
|
|
/** @var array|null */ |
|
99
|
|
|
public $roles; |
|
100
|
|
|
|
|
101
|
|
|
/** @var string */ |
|
102
|
|
|
public $url; |
|
103
|
|
|
|
|
104
|
|
|
/** @var string */ |
|
105
|
|
|
public $projectTypeKey; |
|
106
|
|
|
|
|
107
|
|
|
/** @var string */ |
|
108
|
|
|
public $projectTemplateKey; |
|
109
|
|
|
|
|
110
|
|
|
/** @var int */ |
|
111
|
|
|
public $avatarId; |
|
112
|
|
|
|
|
113
|
|
|
/** @var int */ |
|
114
|
|
|
public $issueSecurityScheme; |
|
115
|
|
|
|
|
116
|
|
|
/** @var int */ |
|
117
|
|
|
public $permissionScheme; |
|
118
|
|
|
|
|
119
|
|
|
/** @var int */ |
|
120
|
|
|
public $notificationScheme; |
|
121
|
|
|
|
|
122
|
|
|
/** @var int */ |
|
123
|
|
|
public $categoryId; |
|
124
|
|
|
|
|
125
|
|
|
public function jsonSerialize() |
|
126
|
|
|
{ |
|
127
|
|
|
return array_filter(get_object_vars($this), function ($var) { |
|
128
|
|
|
return !is_null($var); |
|
129
|
|
|
}); |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @param string $id |
|
134
|
|
|
* |
|
135
|
|
|
* @return Project |
|
136
|
|
|
*/ |
|
137
|
|
|
public function setId($id) |
|
138
|
|
|
{ |
|
139
|
|
|
$this->id = $id; |
|
140
|
|
|
|
|
141
|
|
|
return $this; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* @param string $key |
|
146
|
|
|
* |
|
147
|
|
|
* @return Project |
|
148
|
|
|
*/ |
|
149
|
|
|
public function setKey($key) |
|
150
|
|
|
{ |
|
151
|
|
|
$this->key = $key; |
|
152
|
|
|
|
|
153
|
|
|
return $this; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* @param string $name |
|
158
|
|
|
* |
|
159
|
|
|
* @return Project |
|
160
|
|
|
*/ |
|
161
|
|
|
public function setName($name) |
|
162
|
|
|
{ |
|
163
|
|
|
$this->name = $name; |
|
164
|
|
|
|
|
165
|
|
|
return $this; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @param array $avatarUrls |
|
170
|
|
|
* |
|
171
|
|
|
* @return Project |
|
172
|
|
|
*/ |
|
173
|
|
|
public function setAvatarUrls($avatarUrls) |
|
174
|
|
|
{ |
|
175
|
|
|
$this->avatarUrls = $avatarUrls; |
|
176
|
|
|
|
|
177
|
|
|
return $this; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* @param array $projectCategory |
|
182
|
|
|
* |
|
183
|
|
|
* @return Project |
|
184
|
|
|
*/ |
|
185
|
|
|
public function setProjectCategory($projectCategory) |
|
186
|
|
|
{ |
|
187
|
|
|
$this->projectCategory = $projectCategory; |
|
188
|
|
|
|
|
189
|
|
|
return $this; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* @param null|string $description |
|
194
|
|
|
* |
|
195
|
|
|
* @return Project |
|
196
|
|
|
*/ |
|
197
|
|
|
public function setDescription($description) |
|
198
|
|
|
{ |
|
199
|
|
|
$this->description = $description; |
|
200
|
|
|
|
|
201
|
|
|
return $this; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* @param array $lead |
|
206
|
|
|
* |
|
207
|
|
|
* @return Project |
|
208
|
|
|
*/ |
|
209
|
|
|
public function setLead($lead) |
|
210
|
|
|
{ |
|
211
|
|
|
$this->lead = $lead; |
|
212
|
|
|
|
|
213
|
|
|
return $this; |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
/** |
|
217
|
|
|
* @param string $lead |
|
218
|
|
|
* |
|
219
|
|
|
* @return Project |
|
220
|
|
|
*/ |
|
221
|
|
|
public function setLeadAccountId($leadAccountId) |
|
222
|
|
|
{ |
|
223
|
|
|
$this->leadAccountId = $leadAccountId; |
|
224
|
|
|
|
|
225
|
|
|
return $this; |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
/** |
|
229
|
|
|
* @param string $url |
|
230
|
|
|
* |
|
231
|
|
|
* @return Project |
|
232
|
|
|
*/ |
|
233
|
|
|
public function setUrl($url) |
|
234
|
|
|
{ |
|
235
|
|
|
$this->url = $url; |
|
236
|
|
|
|
|
237
|
|
|
return $this; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
/** |
|
241
|
|
|
* @param string $projectTypeKey |
|
242
|
|
|
* |
|
243
|
|
|
* @return Project |
|
244
|
|
|
*/ |
|
245
|
|
|
public function setProjectTypeKey($projectTypeKey) |
|
246
|
|
|
{ |
|
247
|
|
|
$this->projectTypeKey = $projectTypeKey; |
|
248
|
|
|
|
|
249
|
|
|
return $this; |
|
250
|
|
|
} |
|
251
|
|
|
|
|
252
|
|
|
/** |
|
253
|
|
|
* @param string $projectTemplateKey |
|
254
|
|
|
* |
|
255
|
|
|
* @return Project |
|
256
|
|
|
*/ |
|
257
|
|
|
public function setProjectTemplateKey($projectTemplateKey) |
|
258
|
|
|
{ |
|
259
|
|
|
$this->projectTemplateKey = $projectTemplateKey; |
|
260
|
|
|
|
|
261
|
|
|
return $this; |
|
262
|
|
|
} |
|
263
|
|
|
|
|
264
|
|
|
/** |
|
265
|
|
|
* @param int $avatarId |
|
266
|
|
|
* |
|
267
|
|
|
* @return Project |
|
268
|
|
|
*/ |
|
269
|
|
|
public function setAvatarId($avatarId) |
|
270
|
|
|
{ |
|
271
|
|
|
$this->avatarId = $avatarId; |
|
272
|
|
|
|
|
273
|
|
|
return $this; |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
/** |
|
277
|
|
|
* @param int $issueSecurityScheme |
|
278
|
|
|
* |
|
279
|
|
|
* @return Project |
|
280
|
|
|
*/ |
|
281
|
|
|
public function setIssueSecurityScheme($issueSecurityScheme) |
|
282
|
|
|
{ |
|
283
|
|
|
$this->issueSecurityScheme = $issueSecurityScheme; |
|
284
|
|
|
|
|
285
|
|
|
return $this; |
|
286
|
|
|
} |
|
287
|
|
|
|
|
288
|
|
|
/** |
|
289
|
|
|
* @param int $permissionScheme |
|
290
|
|
|
* |
|
291
|
|
|
* @return Project |
|
292
|
|
|
*/ |
|
293
|
|
|
public function setPermissionScheme($permissionScheme) |
|
294
|
|
|
{ |
|
295
|
|
|
$this->permissionScheme = $permissionScheme; |
|
296
|
|
|
|
|
297
|
|
|
return $this; |
|
298
|
|
|
} |
|
299
|
|
|
|
|
300
|
|
|
/** |
|
301
|
|
|
* @param int $notificationScheme |
|
302
|
|
|
* |
|
303
|
|
|
* @return Project |
|
304
|
|
|
*/ |
|
305
|
|
|
public function setNotificationScheme($notificationScheme) |
|
306
|
|
|
{ |
|
307
|
|
|
$this->notificationScheme = $notificationScheme; |
|
308
|
|
|
|
|
309
|
|
|
return $this; |
|
310
|
|
|
} |
|
311
|
|
|
|
|
312
|
|
|
/** |
|
313
|
|
|
* @param int $categoryId |
|
314
|
|
|
* |
|
315
|
|
|
* @return Project |
|
316
|
|
|
*/ |
|
317
|
|
|
public function setCategoryId($categoryId) |
|
318
|
|
|
{ |
|
319
|
|
|
$this->categoryId = $categoryId; |
|
320
|
|
|
|
|
321
|
|
|
return $this; |
|
322
|
|
|
} |
|
323
|
|
|
|
|
324
|
|
|
/** |
|
325
|
|
|
* @param null|string $assigneeType value available for "PROJECT_LEAD" and "UNASSIGNED". |
|
326
|
|
|
* |
|
327
|
|
|
* @throws JiraException |
|
328
|
|
|
* |
|
329
|
|
|
* @return Project |
|
330
|
|
|
*/ |
|
331
|
|
|
public function setAssigneeType($assigneeType) |
|
332
|
|
|
{ |
|
333
|
|
|
if (!in_array($assigneeType, ['PROJECT_LEAD', 'UNASSIGNED'])) { |
|
334
|
|
|
throw new JiraException('invalid assigneeType:'.$assigneeType); |
|
335
|
|
|
} |
|
336
|
|
|
|
|
337
|
|
|
$this->assigneeType = $assigneeType; |
|
338
|
|
|
|
|
339
|
|
|
return $this; |
|
340
|
|
|
} |
|
341
|
|
|
} |
|
342
|
|
|
|