Code Duplication    Length = 41-42 lines in 3 locations

src/Repo/Branch/Converter/GithubBranchConverter.php 1 location

@@ 13-53 (lines=41) @@
10
/**
11
 * Class GithubBranchConverter.
12
 */
13
class GithubBranchConverter
14
{
15
    use GithubBranchConvertTrait;
16
    use GithubCommitConvertTrait;
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\Branch\GithubBranchSource
37
     */
38
    public function convert($data)
39
    {
40
        return $this->convertBranch($data);
41
    }
42
43
    /**
44
     * @param $dateString
45
     *
46
     * @return DateTime|null
47
     */
48
    protected function getDateIfExists($dateString)
49
    {
50
        if (empty($dateString)) {
51
            return null;
52
        }
53
54
        return new DateTime($dateString);
55
    }
56
}

src/Repo/PullRequest/Converter/GithubPullRequestConverter.php 1 location

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

src/Repo/Tag/Converter/GithubTagConverter.php 1 location

@@ 13-53 (lines=41) @@
10
/**
11
 * Class GithubTagConverter.
12
 */
13
class GithubTagConverter
14
{
15
    use GithubTagConvertTrait;
16
    use GithubCommitConvertTrait;
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\Tag\GithubTagSource
37
     */
38
    public function convert($data)
39
    {
40
        return $this->convertTag($data);
41
    }
42
43
    /**
44
     * @param $dateString
45
     *
46
     * @return DateTime|null
47
     */
48
    protected function getDateIfExists($dateString)
49
    {
50
        if (empty($dateString)) {
51
            return null;
52
        }
53
54
        return new DateTime($dateString);
55
    }
56
}