Completed
Push — master ( 6873e8...20cc66 )
by Miro
02:52 queued 48s
created

GithubIssueSource::getBody()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace DevBoardLib\GithubCore\Issue;
3
4
use DateTime;
5
use DevBoardLib\GithubCore\Issue\GithubIssue;
6
use DevBoardLib\GithubCore\Issue\GithubIssueId;
7
use DevBoardLib\GithubCore\Issue\State\GithubIssueState;
8
use DevBoardLib\GithubCore\Milestone\GithubMilestone;
9
use DevBoardLib\GithubCore\Milestone\GithubMilestoneId;
10
use DevBoardLib\GithubCore\Repo\GithubRepo;
11
use DevBoardLib\GithubCore\Repo\GithubRepoId;
12
use DevBoardLib\GithubCore\User\GithubUser;
13
use DevBoardLib\GithubCore\User\GithubUserId;
14
15
class GithubIssueSource implements GithubIssue
16
{
17
    /** @var GithubIssueId */
18
    protected $id;
19
    /** @var GithubRepo */
20
    protected $repo;
21
    /** @var int */
22
    private $number;
23
    /** @var GithubIssueState */
24
    private $state;
25
    /** @var string */
26
    private $title;
27
    /** @var string */
28
    private $body;
29
    /** @var GithubUser */
30
    private $createdByUser;
31
    /** @var GithubUser */
32
    private $assignedToUser;
33
    /** @var GithubMilestone */
34
    private $milestone;
35
    /** @var int */
36
    private $commentCount;
37
    /** @var \DateTime */
38
    private $githubCreatedAt;
39
    /** @var \DateTime */
40
    private $githubUpdatedAt;
41
    /** @var \DateTime */
42
    private $githubClosedAt;
43
44
    /**
45
     * GithubIssueSource constructor.
46
     *
47
     * @param GithubIssueId    $id
48
     * @param GithubRepo       $repo
49
     * @param int              $number
50
     * @param GithubIssueState $state
51
     * @param string           $title
52
     * @param string           $body
53
     * @param GithubUser       $createdByUser
54
     * @param GithubUser       $assignedToUser
55
     * @param GithubMilestone  $milestone
56
     * @param int              $commentCount
57
     * @param DateTime         $githubCreatedAt
58
     * @param DateTime         $githubUpdatedAt
59
     * @param DateTime         $githubClosedAt
60
     *
61
     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
62
     */
63 View Code Duplication
    public function __construct(
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...
64
        GithubIssueId $id,
65
        GithubRepo $repo,
66
        $number,
67
        GithubIssueState $state,
68
        $title,
69
        $body,
70
        GithubUser $createdByUser,
71
        GithubUser $assignedToUser = null,
72
        GithubMilestone $milestone = null,
73
        $commentCount,
74
        DateTime $githubCreatedAt,
75
        DateTime $githubUpdatedAt,
76
        DateTime $githubClosedAt = null
77
    ) {
78
        $this->id              = $id;
79
        $this->repo            = $repo;
80
        $this->number          = $number;
81
        $this->state           = $state;
82
        $this->title           = $title;
83
        $this->body            = $body;
84
        $this->createdByUser   = $createdByUser;
85
        $this->assignedToUser  = $assignedToUser;
86
        $this->milestone       = $milestone;
87
        $this->commentCount    = $commentCount;
88
        $this->githubCreatedAt = $githubCreatedAt;
89
        $this->githubUpdatedAt = $githubUpdatedAt;
90
        $this->githubClosedAt  = $githubClosedAt;
91
    }
92
93
    /**
94
     * @return GithubIssueId
95
     */
96
    public function getId()
97
    {
98
        return $this->id;
99
    }
100
101
    /**
102
     * @return GithubRepoId
103
     */
104
    public function getRepoId()
105
    {
106
        return $this->repo->getId();
107
    }
108
109
    /**
110
     * @return GithubRepo
111
     */
112
    public function getRepo()
113
    {
114
        return $this->repo;
115
    }
116
117
    /**
118
     * @return int
119
     */
120
    public function getNumber()
121
    {
122
        return $this->number;
123
    }
124
125
    /**
126
     * @return GithubIssueState
127
     */
128
    public function getState()
129
    {
130
        return $this->state;
131
    }
132
133
    /**
134
     * @return string
135
     */
136
    public function getTitle()
137
    {
138
        return $this->title;
139
    }
140
141
    /**
142
     * @return string
143
     */
144
    public function getBody()
145
    {
146
        return $this->body;
147
    }
148
149
    /**
150
     * @return GithubUserId
151
     */
152
    public function getCreatedByUserId()
153
    {
154
        return $this->createdByUser->getGithubUserId();
155
    }
156
157
    /**
158
     * @return GithubUser
159
     */
160
    public function getCreatedByUser()
161
    {
162
        return $this->createdByUser;
163
    }
164
165
    /**
166
     * @return GithubUserId
167
     */
168
    public function getAssignedToUserId()
169
    {
170
        if (null !== $this->assignedToUser) {
171
            return $this->assignedToUser->getGithubUserId();
172
        }
173
174
        return null;
175
    }
176
177
    /**
178
     * @return GithubUser
179
     */
180
    public function getAssignedToUser()
181
    {
182
        return $this->assignedToUser;
183
    }
184
185
    /**
186
     * @return GithubMilestoneId
187
     */
188
    public function getMilestoneId()
189
    {
190
        if (null !== $this->milestone) {
191
            return $this->milestone->getId();
192
        }
193
194
        return null;
195
    }
196
197
    /**
198
     * @return GithubMilestone
199
     */
200
    public function getMilestone()
201
    {
202
        return $this->milestone;
203
    }
204
205
    /**
206
     * @return int
207
     */
208
    public function getCommentCount()
209
    {
210
        return $this->commentCount;
211
    }
212
213
    /**
214
     * @return DateTime
215
     */
216
    public function getGithubCreatedAt()
217
    {
218
        return $this->githubCreatedAt;
219
    }
220
221
    /**
222
     * @return DateTime
223
     */
224
    public function getGithubUpdatedAt()
225
    {
226
        return $this->githubUpdatedAt;
227
    }
228
229
    /**
230
     * @return DateTime
231
     */
232
    public function getGithubClosedAt()
233
    {
234
        return $this->githubClosedAt;
235
    }
236
}
237