GithubPullRequestConverter::convert()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace DevBoardLib\GithubObjectApiFacade\Repo\PullRequest\Converter;
4
5
use DateTime;
6
use DevBoardLib\GithubCore\Repo\GithubRepo;
7
use DevBoardLib\GithubObjectApiFacade\Repo\Commit\Converter\GithubCommitConvertTrait;
8
use DevBoardLib\GithubObjectApiFacade\Repo\Milestone\Converter\GithubMilestoneConvertTrait;
9
use DevBoardLib\GithubObjectApiFacade\User\Converter\GithubUserConvertTrait;
10
11
/**
12
 * Class GithubPullRequestConverter.
13
 */
14 View Code Duplication
class GithubPullRequestConverter
0 ignored issues
show
Duplication introduced by
This class 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...
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
}
59