1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of the GitControlBundle package. |
4
|
|
|
* |
5
|
|
|
* (c) Paul Schweppe <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace VersionControl\GitControlBundle\Entity\Issues; |
12
|
|
|
|
13
|
|
|
abstract class Issue |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var string |
17
|
|
|
*/ |
18
|
|
|
private $title; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
private $description; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* State of issue. |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
private $status; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var \DateTime |
34
|
|
|
*/ |
35
|
|
|
private $closedAt; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var \DateTime |
39
|
|
|
*/ |
40
|
|
|
private $createdAt; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var \DateTime |
44
|
|
|
*/ |
45
|
|
|
private $updatedAt; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var int |
49
|
|
|
*/ |
50
|
|
|
private $id; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var \VersionControl\GitControlBundle\Entity\IssueMilestone |
54
|
|
|
*/ |
55
|
|
|
private $issueMilestone; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var \VersionControl\GitControlBundle\Entity\Project |
59
|
|
|
*/ |
60
|
|
|
private $project; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var array |
64
|
|
|
*/ |
65
|
|
|
private $issueLabel; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Issue comments. |
69
|
|
|
* |
70
|
|
|
* @var array |
71
|
|
|
*/ |
72
|
|
|
private $issueComments; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Constructor. |
76
|
|
|
*/ |
77
|
|
|
public function __construct() |
78
|
|
|
{ |
79
|
|
|
$this->issueLabel = array(); |
80
|
|
|
$this->issueComments = array(); |
81
|
|
|
$this->setCreatedAt(new \DateTime()); |
82
|
|
|
$this->setStatus('open'); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function setId($id) |
86
|
|
|
{ |
87
|
|
|
$this->id = $id; |
88
|
|
|
|
89
|
|
|
return $this; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Set title. |
94
|
|
|
* |
95
|
|
|
* @param string $title |
96
|
|
|
* |
97
|
|
|
* @return Issue |
98
|
|
|
*/ |
99
|
|
|
public function setTitle($title) |
100
|
|
|
{ |
101
|
|
|
$this->title = $title; |
102
|
|
|
|
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Get title. |
108
|
|
|
* |
109
|
|
|
* @return string |
110
|
|
|
*/ |
111
|
|
|
public function getTitle() |
112
|
|
|
{ |
113
|
|
|
return $this->title; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Set description. |
118
|
|
|
* |
119
|
|
|
* @param string $description |
120
|
|
|
* |
121
|
|
|
* @return Issue |
122
|
|
|
*/ |
123
|
|
|
public function setDescription($description) |
124
|
|
|
{ |
125
|
|
|
$this->description = $description; |
126
|
|
|
|
127
|
|
|
return $this; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Get description. |
132
|
|
|
* |
133
|
|
|
* @return string |
134
|
|
|
*/ |
135
|
|
|
public function getDescription() |
136
|
|
|
{ |
137
|
|
|
return $this->description; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Set status. |
142
|
|
|
* |
143
|
|
|
* @param string $status |
144
|
|
|
* |
145
|
|
|
* @return Issue |
146
|
|
|
*/ |
147
|
|
|
public function setStatus($status) |
148
|
|
|
{ |
149
|
|
|
$this->status = $status; |
150
|
|
|
|
151
|
|
|
return $this; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Get status. |
156
|
|
|
* |
157
|
|
|
* @return string |
158
|
|
|
*/ |
159
|
|
|
public function getStatus() |
160
|
|
|
{ |
161
|
|
|
return $this->status; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Set closedAt. |
166
|
|
|
* |
167
|
|
|
* @param \DateTime $closedAt |
168
|
|
|
* |
169
|
|
|
* @return Issue |
170
|
|
|
*/ |
171
|
|
|
public function setClosedAt($closedAt) |
172
|
|
|
{ |
173
|
|
|
$this->closedAt = $closedAt; |
174
|
|
|
|
175
|
|
|
return $this; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Get closedAt. |
180
|
|
|
* |
181
|
|
|
* @return \DateTime |
182
|
|
|
*/ |
183
|
|
|
public function getClosedAt() |
184
|
|
|
{ |
185
|
|
|
return $this->closedAt; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Set createdAt. |
190
|
|
|
* |
191
|
|
|
* @param \DateTime $createdAt |
192
|
|
|
* |
193
|
|
|
* @return Issue |
194
|
|
|
*/ |
195
|
|
|
public function setCreatedAt($createdAt) |
196
|
|
|
{ |
197
|
|
|
$this->createdAt = $createdAt; |
198
|
|
|
|
199
|
|
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Get createdAt. |
204
|
|
|
* |
205
|
|
|
* @return \DateTime |
206
|
|
|
*/ |
207
|
|
|
public function getCreatedAt() |
208
|
|
|
{ |
209
|
|
|
return $this->createdAt; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Set updatedAt. |
214
|
|
|
* |
215
|
|
|
* @param \DateTime $updatedAt |
216
|
|
|
* |
217
|
|
|
* @return Issue |
218
|
|
|
*/ |
219
|
|
|
public function setUpdatedAt($updatedAt) |
220
|
|
|
{ |
221
|
|
|
$this->updatedAt = $updatedAt; |
222
|
|
|
|
223
|
|
|
return $this; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Get updatedAt. |
228
|
|
|
* |
229
|
|
|
* @return \DateTime |
230
|
|
|
*/ |
231
|
|
|
public function getUpdatedAt() |
232
|
|
|
{ |
233
|
|
|
return $this->updatedAt; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Set githubNumber. |
238
|
|
|
* |
239
|
|
|
* @param int $githubNumber |
240
|
|
|
* |
241
|
|
|
* @return Issue |
242
|
|
|
*/ |
243
|
|
|
public function setGithubNumber($githubNumber) |
244
|
|
|
{ |
245
|
|
|
$this->githubNumber = $githubNumber; |
|
|
|
|
246
|
|
|
|
247
|
|
|
return $this; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* Get githubNumber. |
252
|
|
|
* |
253
|
|
|
* @return int |
254
|
|
|
*/ |
255
|
|
|
public function getGithubNumber() |
256
|
|
|
{ |
257
|
|
|
return $this->githubNumber; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* Get id. |
262
|
|
|
* |
263
|
|
|
* @return int |
264
|
|
|
*/ |
265
|
|
|
public function getId() |
266
|
|
|
{ |
267
|
|
|
return $this->id; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* Set issueMilestone. |
272
|
|
|
* |
273
|
|
|
* @param \VersionControl\GitControlBundle\Entity\IssueMilestone $issueMilestone |
274
|
|
|
* |
275
|
|
|
* @return Issue |
276
|
|
|
*/ |
277
|
|
|
public function setIssueMilestone(\VersionControl\GitControlBundle\IssueMilestone $issueMilestone = null) |
|
|
|
|
278
|
|
|
{ |
279
|
|
|
$this->issueMilestone = $issueMilestone; |
280
|
|
|
|
281
|
|
|
return $this; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* Get issueMilestone. |
286
|
|
|
* |
287
|
|
|
* @return \VersionControl\GitControlBundle\Entity\IssueMilestone |
288
|
|
|
*/ |
289
|
|
|
public function getIssueMilestone() |
290
|
|
|
{ |
291
|
|
|
return $this->issueMilestone; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
/** |
295
|
|
|
* Set project. |
296
|
|
|
* |
297
|
|
|
* @param \VersionControl\GitControlBundle\Entity\Project $project |
298
|
|
|
* |
299
|
|
|
* @return Issue |
300
|
|
|
*/ |
301
|
|
|
public function setProject(\VersionControl\GitControlBundle\Entity\Project $project = null) |
302
|
|
|
{ |
303
|
|
|
$this->project = $project; |
304
|
|
|
|
305
|
|
|
return $this; |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* Get project. |
310
|
|
|
* |
311
|
|
|
* @return \VersionControl\GitControlBundle\Entity\Project |
312
|
|
|
*/ |
313
|
|
|
public function getProject() |
314
|
|
|
{ |
315
|
|
|
return $this->project; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* Get User. |
320
|
|
|
* |
321
|
|
|
* @return \VersionControl\GitControlBundle\Entity\Issues\IssueUserInterface |
322
|
|
|
*/ |
323
|
|
|
public function getUser() |
324
|
|
|
{ |
325
|
|
|
return $this->user; |
|
|
|
|
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* Add issueLabel. |
330
|
|
|
* |
331
|
|
|
* @param \VersionControl\GitControlBundle\Entity\Issues\IssueLabel $issueLabel |
332
|
|
|
* |
333
|
|
|
* @return Issue |
334
|
|
|
*/ |
335
|
|
|
public function addIssueLabel(\VersionControl\GitControlBundle\Entity\Issues\IssueLabel $issueLabel) |
336
|
|
|
{ |
337
|
|
|
$this->issueLabel[] = $issueLabel; |
338
|
|
|
|
339
|
|
|
return $this; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* Remove issueLabel. |
344
|
|
|
* |
345
|
|
|
* @param \VersionControl\GitControlBundle\Entity\Issues\IssueLabel $issueLabel |
346
|
|
|
*/ |
347
|
|
|
public function removeIssueLabel(\VersionControl\GitControlBundle\Entity\Issues\IssueLabel $issueLabel) |
348
|
|
|
{ |
349
|
|
|
$this->issueLabel->removeElement($issueLabel); |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* Get issueLabel. |
354
|
|
|
* |
355
|
|
|
* @return array |
356
|
|
|
*/ |
357
|
|
|
public function getIssueLabel() |
358
|
|
|
{ |
359
|
|
|
return $this->issueLabel; |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
/** |
363
|
|
|
* Get Issue Comments. |
364
|
|
|
* |
365
|
|
|
* @return array of \VersionControl\GitControlBundle\Entity\Issue\IssueCommentInteface |
366
|
|
|
*/ |
367
|
|
|
public function getIssueComments() |
368
|
|
|
{ |
369
|
|
|
return $this->issueComments; |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
/** |
373
|
|
|
* Set Issue Comments. |
374
|
|
|
* |
375
|
|
|
* @param array $issueComments |
376
|
|
|
* |
377
|
|
|
* @return \VersionControl\GitControlBundle\Entity\Issue |
378
|
|
|
*/ |
379
|
|
|
public function setIssueComments(array $issueComments) |
380
|
|
|
{ |
381
|
|
|
$this->issueComments = $issueComments; |
382
|
|
|
|
383
|
|
|
return $this; |
|
|
|
|
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
/** |
387
|
|
|
* Set status. |
388
|
|
|
* |
389
|
|
|
* @param string $status |
390
|
|
|
* |
391
|
|
|
* @return Issue |
392
|
|
|
*/ |
393
|
|
|
public function setClosed() |
394
|
|
|
{ |
395
|
|
|
$this->status = 'closed'; |
396
|
|
|
|
397
|
|
|
return $this; |
398
|
|
|
} |
399
|
|
|
|
400
|
|
|
/** |
401
|
|
|
* Set status. |
402
|
|
|
* |
403
|
|
|
* @param string $status |
404
|
|
|
* |
405
|
|
|
* @return Issue |
406
|
|
|
*/ |
407
|
|
|
public function setOpen() |
408
|
|
|
{ |
409
|
|
|
$this->status = 'open'; |
410
|
|
|
|
411
|
|
|
return $this; |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
public function isClosed() |
415
|
|
|
{ |
416
|
|
|
return ($this->status === 'closed') ? true : false; |
417
|
|
|
} |
418
|
|
|
} |
419
|
|
|
|