Completed
Pull Request — master (#29)
by Yann
01:35
created

ConfigurableEnum   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 38
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A getChoices() 0 4 1
1
<?php
2
3
namespace Yokai\Enum;
4
5
/**
6
 * @author Yann Eugoné <[email protected]>
7
 */
8
class ConfigurableEnum implements EnumInterface
9
{
10
    /**
11
     * @var string
12
     */
13
    private $name;
14
15
    /**
16
     * @var array
17
     */
18
    private $choices;
19
20
    /**
21
     * @param string $name
22
     * @param array  $choices
23
     */
24 10
    public function __construct($name, array $choices)
25
    {
26 10
        $this->name = $name;
27 10
        $this->choices = $choices;
28 10
    }
29
30
    /**
31
     * @inheritdoc
32
     */
33 2
    public function getName()
34
    {
35 2
        return $this->name;
36
    }
37
38
    /**
39
     * @inheritdoc
40
     */
41 6
    public function getChoices()
42
    {
43 6
        return $this->choices;
44
    }
45
}
46