GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

IssueField::setAssigneeName()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace JiraRestApi\Issue;
4
5
use JiraRestApi\Project\Project;
6
7
class IssueField implements \JsonSerializable
8
{
9
    /**
10
     * @var string
11
     */
12
    public $summary;
13
14
    /**
15
     * @var array
16
     */
17
    public $progress;
18
19
    /**
20
     * @var \JiraRestApi\Issue\TimeTracking
21
     */
22
    public $timeTracking;
23
24
    /**
25
     * @var \JiraRestApi\Issue\IssueType
26
     */
27
    public $issuetype;
28
29
    /**
30
     * @var string|null
31
     */
32
    public $timespent;
33
34
    /**
35
     * @var \JiraRestApi\Issue\Reporter|null
36
     */
37
    public $reporter;
38
39
    /**
40
     * @var \DateTime
41
     */
42
    public $created;
43
44
    /**
45
     * @var \DateTime
46
     */
47
    public $updated;
48
49
    /**
50
     * @var string|null
51
     */
52
    public $description;
53
54
    /**
55
     * @var \JiraRestApi\Issue\Priority
56
     */
57
    public $priority;
58
59
    /**
60
     * @var object
61
     */
62
    public $status;
63
64
    /**
65
     * @var array
66
     */
67
    public $labels;
68
69
    /**
70
     * @var \JiraRestApi\Project\Project
71
     */
72
    public $project;
73
74
    /**
75
     * @var string|null
76
     */
77
    public $environment;
78
79
    /**
80
     * @var array
81
     */
82
    public $components;
83
84
    /**
85
     * @var \JiraRestApi\Issue\Comments
86
     */
87
    public $comment;
88
89
    /**
90
     * @var object
91
     */
92
    public $votes;
93
94
    /**
95
     * @var object|null
96
     */
97
    public $resolution;
98
99
    /**
100
     * @var array
101
     */
102
    public $fixVersions;
103
104
    /**
105
     * @var \JiraRestApi\Issue\Reporter
106
     */
107
    public $creator;
108
109
    /**
110
     * @var object
111
     */
112
    public $watches;
113
114
    /**
115
     * @var object
116
     */
117
    public $worklog;
118
119
    /**
120
     * @var \JiraRestApi\Issue\Reporter|null
121
     */
122
    public $assignee;
123
124
    /**
125
     * @var \JiraRestApi\Issue\Version[]
126
     */
127
    public $versions;
128
129
    /**
130
     * @var \JiraRestApi\Issue\Attachment[]
131
     */
132
    public $attachment;
133
134
    /**
135
     * @var string|null
136
     */
137
    public $aggregatetimespent;
138
139
    /**
140
     * @var string|null
141
     */
142
    public $timeestimate;
143
144
    /**
145
     * @var string|null
146
     */
147
    public $aggregatetimeoriginalestimate;
148
149
    /**
150
     * @var string|null
151
     */
152
    public $resolutiondate;
153
154
    /**
155
     * @var \DateTime|null
156
     */
157
    public $duedate;
158
159
    /**
160
     * @var array
161
     */
162
    public $issuelinks;
163
164
    /**
165
     * @var array
166
     */
167
    public $subtasks;
168
169
    /**
170
     * @var int|null
171
     */
172
    public $workratio;
173
174
    /**
175
     * @var object|null
176
     */
177
    public $aggregatetimeestimate;
178
179
    /**
180
     * @var object|null
181
     */
182
    public $aggregateprogress;
183
184
    /**
185
     * @var object|null
186
     */
187
    public $lastViewed;
188
189
    /**
190
     * @var object|null
191
     */
192
    public $timeoriginalestimate;
193
194
    /**
195
     * IssueField constructor.
196
     * @param bool $updateIssue
197
     */
198
    public function __construct($updateIssue = false)
199
    {
200
        if (!$updateIssue) {
201
            $this->project = new Project();
202
203
            $this->assignee = new Reporter();
204
            $this->priority = new Priority();
205
            $this->versions = [];
206
207
            $this->issuetype = new IssueType();
208
        }
209
    }
210
211
    public function jsonSerialize()
212
    {
213
        return array_filter(get_object_vars($this));
214
    }
215
216
    public function getProjectKey()
217
    {
218
        return $this->project->key;
219
    }
220
221
    public function getProjectId()
222
    {
223
        return $this->project->id;
224
    }
225
226
    public function getIssueType()
227
    {
228
        return $this->issuetype;
229
    }
230
231 View Code Duplication
    public function setProjectKey($key)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
232
    {
233
        if(is_null($this->project)) {
234
            $this->project = new Project();
235
        }
236
237
        $this->project->key = (string) $key;
238
239
        return $this;
240
    }
241
242 View Code Duplication
    public function setProjectId($id)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
243
    {
244
        if(is_null($this->project)) {
245
            $this->project = new Project();
246
        }
247
248
        $this->project->id = (string) $id;
249
250
        return $this;
251
    }
252
253
    public function setSummary($summary)
254
    {
255
        $this->summary = $summary;
256
257
        return $this;
258
    }
259
260
    /**
261
     * @param string|null $description
262
     *
263
     * @return $this
264
     */
265
    public function setDescription($description)
266
    {
267
        $this->description = $description;
268
269
        return $this;
270
    }
271
272
    public function setReporterName($name)
273
    {
274
        if (is_null($this->reporter)) {
275
            $this->reporter = new Reporter();
276
        }
277
278
        $this->reporter->name = (string) $name;
279
280
        return $this;
281
    }
282
283
    public function setAssigneeName($name)
284
    {
285
        if (is_null($this->assignee)) {
286
            $this->assignee = new Reporter();
287
        }
288
289
        $this->assignee->name = (string) $name;
290
291
        return $this;
292
    }
293
294 View Code Duplication
    public function setPriorityId($id)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
295
    {
296
        if (is_null($this->priority)) {
297
            $this->priority = new Priority();
298
        }
299
300
        $this->priority->id = (string) $id;
301
302
        return $this;
303
    }
304
305 View Code Duplication
    public function setPriorityName($name)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
306
    {
307
        if (is_null($this->priority)) {
308
            $this->priority = new Priority();
309
        }
310
311
        $this->priority->name = (string) $name;
312
313
        return $this;
314
    }
315
316
    public function addVersion($name)
317
    {
318
        if (is_null($this->versions)) {
319
            $this->versions = [];
320
        }
321
322
        $v = new Version();
323
        $v->name = (string) $name;
324
325
        array_push($this->versions, $v);
326
327
        return $this;
328
    }
329
330
    public function addComment($comment)
331
    {
332
        if (is_null($this->comment)) {
333
            $this->comment = [];
0 ignored issues
show
Documentation Bug introduced by
It seems like array() of type array is incompatible with the declared type object<JiraRestApi\Issue\Comments> of property $comment.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
334
        }
335
336
        array_push($this->comment, $comment);
337
338
        return $this;
339
    }
340
341
    public function addLabel($label)
342
    {
343
        if (is_null($this->labels)) {
344
            $this->labels = [];
345
        }
346
347
        array_push($this->labels, $label);
348
349
        return $this;
350
    }
351
352 View Code Duplication
    public function setIssueTypeName($name)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
353
    {
354
        if (is_null($this->issuetype)) {
355
            $this->issuetype = new IssueType();
356
        }
357
358
        $this->issuetype->name = (string) $name;
359
360
        return $this;
361
    }
362
363 View Code Duplication
    public function setIssueTypeId($id)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
364
    {
365
        if (is_null($this->issuetype)) {
366
            $this->issuetype = new IssueType();
367
        }
368
369
        $this->issuetype->id = (string) $id;
370
371
        return $this;
372
    }
373
}
374