GithubIssueConverter::__construct()   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\Issue\Converter;
4
5
use DateTime;
6
use DevBoardLib\GithubCore\Repo\GithubRepo;
7
use DevBoardLib\GithubObjectApiFacade\Repo\Milestone\Converter\GithubMilestoneConvertTrait;
8
use DevBoardLib\GithubObjectApiFacade\User\Converter\GithubUserConvertTrait;
9
10
/**
11
 * Class GithubIssueConverter.
12
 */
13 View Code Duplication
class GithubIssueConverter
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...
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
47
     */
48
    protected function getDateIfExists($dateString)
49
    {
50
        if (empty($dateString)) {
51
            return null;
52
        }
53
54
        return new DateTime($dateString);
55
    }
56
}
57