Completed
Pull Request — master (#1)
by Miro
03:33
created

GithubMilestoneConverter::getDateIfExists()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 8
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
namespace DevBoardLib\GithubObjectApiFacade\Repo\Milestone\Converter;
3
4
use DateTime;
5
use DevBoardLib\GithubCore\Repo\GithubRepo;
6
use DevBoardLib\GithubObjectApiFacade\User\Converter\GithubUserConvertTrait;
7
8 View Code Duplication
class GithubMilestoneConverter
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...
9
{
10
    use GithubMilestoneConvertTrait;
11
    use GithubUserConvertTrait;
12
    private $githubRepo;
13
14
    /**
15
     * GithubMilestoneConverter constructor.
16
     *
17
     * @param $githubRepo
18
     */
19
    public function __construct(GithubRepo $githubRepo)
20
    {
21
        $this->githubRepo = $githubRepo;
22
    }
23
24
    public function convert($data)
25
    {
26
        return $this->convertMilestone($data);
27
    }
28
29
    protected function getDateIfExists($dateString)
30
    {
31
        if (empty($dateString)) {
32
            return null;
33
        }
34
35
        return new DateTime($dateString);
36
    }
37
}
38