Code Duplication    Length = 30-40 lines in 3 locations

src/Repo/CommitStatus/Converter/GithubCommitStatusConverter.php 1 location

@@ 11-50 (lines=40) @@
8
/**
9
 * Class GithubCommitStatusConverter.
10
 */
11
class GithubCommitStatusConverter
12
{
13
    use GithubCommitStatusConvertTrait;
14
    use GithubUserConvertTrait;
15
    private $githubRepo;
16
17
    /**
18
     * GithubMilestoneConverter constructor.
19
     *
20
     * @param $githubRepo
21
     */
22
    public function __construct(GithubRepo $githubRepo)
23
    {
24
        $this->githubRepo = $githubRepo;
25
    }
26
27
    /**
28
     * @param $data
29
     *
30
     * @return \DevBoardLib\GithubCore\CommitStatus\GithubCommitStatusSource
31
     */
32
    public function convert($data)
33
    {
34
        return $this->convertCommitStatus($data);
35
    }
36
37
    /**
38
     * @param $dateString
39
     *
40
     * @return DateTime|null
41
     */
42
    protected function getDateIfExists($dateString)
43
    {
44
        if (empty($dateString)) {
45
            return null;
46
        }
47
48
        return new DateTime($dateString);
49
    }
50
}
51

src/Repo/Issue/Converter/GithubIssueConverter.php 1 location

@@ 12-42 (lines=31) @@
9
/**
10
 * Class GithubIssueConverter.
11
 */
12
class GithubIssueConverter
13
{
14
    use GithubIssueConvertTrait;
15
    use GithubMilestoneConvertTrait;
16
    use GithubUserConvertTrait;
17
    private $githubRepo;
18
19
    /**
20
     * GithubMilestoneConverter constructor.
21
     *
22
     * @param $githubRepo
23
     */
24
    public function __construct(GithubRepo $githubRepo)
25
    {
26
        $this->githubRepo = $githubRepo;
27
    }
28
29
    /**
30
     * @param $data
31
     *
32
     * @return \DevBoardLib\GithubCore\Issue\GithubIssueSource
33
     */
34
    public function convert($data)
35
    {
36
        return $this->convertIssue($data);
37
    }
38
39
    /**
40
     * @param $dateString
41
     *
42
     * @return DateTime|null
43
     */
44
    protected function getDateIfExists($dateString)
45
    {

src/Repo/Milestone/Converter/GithubMilestoneConverter.php 1 location

@@ 11-40 (lines=30) @@
8
/**
9
 * Class GithubMilestoneConverter.
10
 */
11
class GithubMilestoneConverter
12
{
13
    use GithubMilestoneConvertTrait;
14
    use GithubUserConvertTrait;
15
    private $githubRepo;
16
17
    /**
18
     * GithubMilestoneConverter constructor.
19
     *
20
     * @param $githubRepo
21
     */
22
    public function __construct(GithubRepo $githubRepo)
23
    {
24
        $this->githubRepo = $githubRepo;
25
    }
26
27
    /**
28
     * @param $data
29
     *
30
     * @return \DevBoardLib\GithubCore\Milestone\GithubMilestoneSource
31
     */
32
    public function convert($data)
33
    {
34
        return $this->convertMilestone($data);
35
    }
36
37
    /**
38
     * @param $dateString
39
     *
40
     * @return DateTime|null
41
     */
42
    protected function getDateIfExists($dateString)
43
    {