GithubMilestoneSource::getClosedIssueCount()   A
last analyzed

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
3
namespace DevBoardLib\GithubCore\Milestone;
4
5
use DateTime;
6
use DevBoardLib\GithubCore\Milestone\State\GithubMilestoneState;
7
use DevBoardLib\GithubCore\Repo\GithubRepo;
8
use DevBoardLib\GithubCore\Repo\GithubRepoId;
9
use DevBoardLib\GithubCore\User\GithubUser;
10
use DevBoardLib\GithubCore\User\GithubUserId;
11
12
/**
13
 * Class GithubMilestoneSource.
14
 */
15
class GithubMilestoneSource implements GithubMilestone
16
{
17
    /** @var GithubMilestoneId */
18
    protected $id;
19
    /** @var GithubRepo */
20
    protected $repo;
21
    /** @var int */
22
    private $number;
23
    /** @var GithubMilestoneState */
24
    private $state;
25
    /** @var string */
26
    private $title;
27
    /** @var string */
28
    private $description;
29
    /** @var GithubUser */
30
    private $createdByUser;
31
    /** @var int */
32
    private $openIssueCount;
33
    /** @var int */
34
    private $closedIssueCount;
35
    /** @var \DateTime */
36
    private $dueDate;
37
    /** @var \DateTime */
38
    private $githubCreatedAt;
39
    /** @var \DateTime */
40
    private $githubUpdatedAt;
41
    /** @var \DateTime */
42
    private $githubClosedAt;
43
44
    /**
45
     * GithubMilestoneSource constructor.
46
     *
47
     * @param GithubMilestoneId    $id
48
     * @param GithubRepo           $repo
49
     * @param int                  $number
50
     * @param GithubMilestoneState $state
51
     * @param string               $title
52
     * @param string               $description
53
     * @param GithubUser           $createdByUser
54
     * @param int                  $openIssueCount
55
     * @param int                  $closedIssueCount
56
     * @param DateTime             $dueDate
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
        GithubMilestoneId $id,
65
        GithubRepo $repo,
66
        $number,
67
        GithubMilestoneState $state,
68
        $title,
69
        $description,
70
        GithubUser $createdByUser = null,
71
        $openIssueCount,
72
        $closedIssueCount,
73
        DateTime $dueDate = null,
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->description      = $description;
84
        $this->createdByUser    = $createdByUser;
85
        $this->openIssueCount   = $openIssueCount;
86
        $this->closedIssueCount = $closedIssueCount;
87
        $this->dueDate          = $dueDate;
88
        $this->githubCreatedAt  = $githubCreatedAt;
89
        $this->githubUpdatedAt  = $githubUpdatedAt;
90
        $this->githubClosedAt   = $githubClosedAt;
91
    }
92
93
    /**
94
     * @return GithubMilestoneId
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 GithubMilestoneState
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 getDescription()
145
    {
146
        return $this->description;
147
    }
148
149
    /**
150
     * @return GithubUserId
151
     */
152
    public function getCreatedByUserId()
153
    {
154
        if (null === $this->createdByUser) {
155
            return null;
156
        }
157
158
        return $this->createdByUser->getGithubUserId();
159
    }
160
161
    /**
162
     * @return GithubUser
163
     */
164
    public function getCreatedByUser()
165
    {
166
        return $this->createdByUser;
167
    }
168
169
    /**
170
     * @return int
171
     */
172
    public function getOpenIssueCount()
173
    {
174
        return $this->openIssueCount;
175
    }
176
177
    /**
178
     * @return int
179
     */
180
    public function getClosedIssueCount()
181
    {
182
        return $this->closedIssueCount;
183
    }
184
185
    /**
186
     * @return DateTime
187
     */
188
    public function getDueDate()
189
    {
190
        return $this->dueDate;
191
    }
192
193
    /**
194
     * @return DateTime
195
     */
196
    public function getGithubCreatedAt()
197
    {
198
        return $this->githubCreatedAt;
199
    }
200
201
    /**
202
     * @return DateTime
203
     */
204
    public function getGithubUpdatedAt()
205
    {
206
        return $this->githubUpdatedAt;
207
    }
208
209
    /**
210
     * @return DateTime
211
     */
212
    public function getGithubClosedAt()
213
    {
214
        return $this->githubClosedAt;
215
    }
216
}
217