1 | <?php |
||
5 | class Issue |
||
6 | { |
||
7 | /** |
||
8 | * @var Client |
||
9 | */ |
||
10 | private $client; |
||
11 | |||
12 | /** |
||
13 | * @var int |
||
14 | */ |
||
15 | private $projectId; |
||
16 | |||
17 | /** |
||
18 | * @var int |
||
19 | */ |
||
20 | private $id; |
||
21 | |||
22 | private $title = null; |
||
23 | private $priorityLevel = null; |
||
24 | private $fixer = null; |
||
25 | private $tester = null; |
||
26 | private $description = null; |
||
27 | private $dueDate = null; |
||
28 | private $attachments = []; |
||
29 | private $userIdsToCc = null; |
||
30 | private $tags = null; |
||
31 | |||
32 | /** |
||
33 | * @param Client $client |
||
34 | * @param int $projectId |
||
35 | * @param int $id |
||
36 | */ |
||
37 | 66 | function __construct($client = null, $projectId = null, $id = null) |
|
|
|||
38 | { |
||
39 | 66 | $this->client = $client; |
|
40 | 66 | $this->projectId = $projectId; |
|
41 | 66 | $this->id = $id; |
|
42 | 66 | } |
|
43 | |||
44 | /** |
||
45 | * @param string $description |
||
46 | */ |
||
47 | 3 | public function setDescription($description) |
|
51 | |||
52 | /** |
||
53 | * @param int $fixer |
||
54 | */ |
||
55 | 3 | public function setFixer($fixer) |
|
59 | |||
60 | /** |
||
61 | * @param int $priorityLevel |
||
62 | */ |
||
63 | 3 | public function setPriorityLevel($priorityLevel) |
|
67 | |||
68 | /** |
||
69 | * @param int $tester |
||
70 | */ |
||
71 | 3 | public function setTester($tester) |
|
75 | |||
76 | /** |
||
77 | * @param string $title |
||
78 | */ |
||
79 | 3 | public function setTitle($title) |
|
83 | |||
84 | /** |
||
85 | * Due date. Accepts Unix timestamp, or a formatted date string. |
||
86 | * |
||
87 | * Examples: 2014-09-20 16:40:31, 1411231231 |
||
88 | * |
||
89 | * @param string|int $dueDate |
||
90 | */ |
||
91 | 6 | public function setDueDate($dueDate) |
|
92 | { |
||
93 | 6 | if (is_numeric($dueDate)) { |
|
94 | 3 | $dueDate = date('Y-m-d H:i:s', $dueDate); |
|
95 | 3 | } |
|
96 | 6 | $this->dueDate = $dueDate; |
|
97 | 6 | } |
|
98 | |||
99 | /** |
||
100 | * Add an attachment to the issue |
||
101 | * |
||
102 | * @param string $file |
||
103 | */ |
||
104 | 3 | public function addAttachment($file) |
|
108 | |||
109 | /** |
||
110 | * Set user IDs to CC. Can be an array of IDs, a comma separated list of |
||
111 | * IDs, or just a single ID. |
||
112 | * |
||
113 | * @param array|string|int $ids |
||
114 | */ |
||
115 | 6 | public function setUserIdsToCc($ids) |
|
123 | |||
124 | /** |
||
125 | * Set tags. Can be an array of tags, a comma separated list of |
||
126 | * tags, or just a single tag. |
||
127 | * |
||
128 | * @param array|string $tags |
||
129 | */ |
||
130 | 6 | public function setTags($tags) |
|
138 | |||
139 | /** |
||
140 | * Add a new comment to the issue |
||
141 | * |
||
142 | * @param Comment $comment |
||
143 | * |
||
144 | * @return array |
||
145 | */ |
||
146 | 3 | public function addComment($comment) |
|
157 | |||
158 | /** |
||
159 | * Get a list of people who can be cc’d or assigned as the fixer or tester to the issue |
||
160 | * |
||
161 | * @return array |
||
162 | */ |
||
163 | 3 | public function availableReassignees() |
|
173 | |||
174 | /** |
||
175 | * Get the details of this issue |
||
176 | * |
||
177 | * @return array |
||
178 | */ |
||
179 | public function get() |
||
185 | |||
186 | /** |
||
187 | * Get a list of issue statuses the authenticated user may update the issue |
||
188 | * |
||
189 | * @return array |
||
190 | */ |
||
191 | 3 | public function availableStatuses() |
|
201 | |||
202 | /** |
||
203 | * Update the status of this issue |
||
204 | * |
||
205 | * @param int $newStatus |
||
206 | * @param string|null $comment |
||
207 | * @param array $attachments |
||
208 | * |
||
209 | * @return array |
||
210 | */ |
||
211 | 3 | public function updateStatus( |
|
222 | /** |
||
223 | * Update the priority level of this issue |
||
224 | * |
||
225 | * @param int $newLevel |
||
226 | * @param string|null $comment |
||
227 | * @param array $attachments |
||
228 | * |
||
229 | * @return array |
||
230 | */ |
||
231 | 3 | public function updatePriorityLevel( |
|
242 | |||
243 | /** |
||
244 | * Update the tester of this issue |
||
245 | * |
||
246 | * @param int $newTester |
||
247 | * @param string|null $comment |
||
248 | * @param array $attachments |
||
249 | * |
||
250 | * @return array |
||
251 | */ |
||
252 | 3 | public function updateTester( |
|
263 | |||
264 | /** |
||
265 | * Update the fixer of this issue |
||
266 | * |
||
267 | * @param int $newFixer |
||
268 | * @param string|null $comment |
||
269 | * @param array $attachments |
||
270 | * |
||
271 | * @return array |
||
272 | */ |
||
273 | 6 | public function updateFixer( |
|
284 | |||
285 | /** |
||
286 | * @param string $endpoint |
||
287 | * @param array $data |
||
288 | * @param string $comment |
||
289 | * @param array $attachments |
||
290 | * |
||
291 | * @return array |
||
292 | */ |
||
293 | 15 | private function update($endpoint, $data, $comment, $attachments) |
|
313 | |||
314 | /** |
||
315 | * @return array |
||
316 | */ |
||
317 | 42 | public function toArray() |
|
348 | |||
349 | } |
||
350 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.