Completed
Push — master ( adaca1...cbbaf6 )
by Miro
02:00
created

GithubMilestoneStateFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 3
1
<?php
2
namespace DevBoardLib\GithubCore\Milestone\State;
3
4
use Exception;
5
6
/**
7
 * Class GithubMilestoneStateFactory.
8
 */
9
class GithubMilestoneStateFactory
10
{
11
    /**
12
     * @param $githubMilestoneStateTest
13
     *
14
     * @throws Exception
15
     *
16
     * @return GithubMilestoneClosedState|GithubMilestoneOpenState
17
     */
18
    public static function create($githubMilestoneStateTest)
19
    {
20
        if ($githubMilestoneStateTest === 'open') {
21
            return new GithubMilestoneOpenState();
22
        } elseif ($githubMilestoneStateTest === 'closed') {
23
            return new GithubMilestoneClosedState();
24
        }
25
26
        throw new Exception($githubMilestoneStateTest.' is not recognized issue state');
27
    }
28
}
29