Code Duplication    Length = 30-40 lines in 3 locations

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

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

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

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

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

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