Code Duplication    Length = 41-42 lines in 3 locations

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

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

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

@@ 13-54 (lines=42) @@
10
/**
11
 * Class GithubPullRequestConverter.
12
 */
13
class GithubPullRequestConverter
14
{
15
    use GithubPullRequestConvertTrait;
16
    use GithubCommitConvertTrait;
17
    use GithubMilestoneConvertTrait;
18
    use GithubUserConvertTrait;
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\PullRequest\GithubPullRequestSource
35
     */
36
    public function convert($data)
37
    {
38
        return $this->convertPullRequest($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
}
55

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

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