Completed
Pull Request — master (#265)
by Christian
01:48
created

Component::setAssigneeType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace JiraRestApi\Component;
4
5
use JiraRestApi\ClassSerialize;
6
use JiraRestApi\Project\Project;
7
use JiraRestApi\User\User;
8
9
/**
10
 * Class Component.
11
 *
12
 *
13
 * @see https://docs.atlassian.com/jira/REST/server/#api/2/component
14
 */
15
class Component implements \JsonSerializable
16
{
17
    use ClassSerialize;
18
19
    /**
20
     * uri which was hit.
21
     *
22
     * @var string
23
     */
24
    public $self;
25
26
    /**
27
     * @var string
28
     */
29
    public $name;
30
31
    /**
32
     * @var string
33
     */
34
    public $description;
35
36
    /**
37
     * @var \JiraRestApi\User\User
38
     */
39
    public $lead;
40
41
    /**
42
     * @var string
43
     */
44
    public $assigneeType;
45
46
    /**
47
     * @var int
48
     */
49
    public $projectId;
50
51
    /**
52
     * @var string
53
     */
54
    public $project;
55
56
    /**
57
     * @var bool
58
     */
59
    public $isAssigneeTypeValid;
60
61
    /**
62
     * @return string
63
     */
64
    public function getName()
65
    {
66
        return $this->name;
67
    }
68
69
    /**
70
     * @param string $name
71
     *
72
     * @return Component
73
     */
74
    public function setName($name)
75
    {
76
        $this->name = $name;
77
78
        return $this;
79
    }
80
81
    /**
82
     * @param string $description
83
     *
84
     * @return Component
85
     */
86
    public function setDescription($description)
87
    {
88
        $this->description = $description;
89
90
        return $this;
91
    }
92
93
    /**
94
     * @param string $leadUserName
95
     *
96
     * @return Component
97
     */
98
    public function setLeadUserName($leadUserName)
99
    {
100
        if ($this->lead === null) {
101
            $this->lead = new User();
102
        }
103
104
        $this->lead->name = $leadUserName;
105
106
        return $this;
107
    }
108
109
    /**
110
     * @param string $assigneeType
111
     *
112
     * @return Component
113
     */
114
    public function setAssigneeType($assigneeType)
115
    {
116
        $this->assigneeType = $assigneeType;
117
118
        return $this;
119
    }
120
121
    /**
122
     * @param string $projectKey
123
     *
124
     * @return Component
125
     */
126
    public function setProjectKey($projectKey)
127
    {
128
        $this->project = $projectKey;
129
130
        return $this;
131
    }
132
133
    /**
134
     * @param Project $project
135
     *
136
     * @return $this
137
     */
138
    public function setProject(Project $project)
139
    {
140
        $this->project = $project->key;
141
142
        return $this;
143
    }
144
145
    /**
146
     * @return array|mixed
147
     */
148
    public function jsonSerialize()
149
    {
150
        return array_filter(get_object_vars($this));
151
    }
152
}
153