GithubIssueStateFactory   A
last analyzed

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
3
namespace DevBoardLib\GithubCore\Issue\State;
4
5
use Exception;
6
7
/**
8
 * Class GithubIssueStateFactory.
9
 */
10
class GithubIssueStateFactory
11
{
12
    /**
13
     * @param $githubIssueStateTest
14
     *
15
     * @throws Exception
16
     *
17
     * @return GithubIssueClosedState|GithubIssueOpenState
18
     */
19
    public static function create($githubIssueStateTest)
20
    {
21
        if ($githubIssueStateTest === 'open') {
22
            return new GithubIssueOpenState();
23
        } elseif ($githubIssueStateTest === 'closed') {
24
            return new GithubIssueClosedState();
25
        }
26
27
        throw new Exception($githubIssueStateTest.' is not recognized issue state');
28
    }
29
}
30