EnumValueDefinition::getValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Fubhy\GraphQL\Type\Definition;
4
5
class EnumValueDefinition
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $name;
11
12
    /**
13
     * @var string|null
14
     */
15
    protected $description;
16
17
    /**
18
     * @var mixed
19
     */
20
    protected $value;
21
22
    /**
23
     * @var string|null
24
     */
25
    protected $deprecationReason;
26
27
    /**
28
     * Constructor.
29
     *
30
     * @param array $config
31
     */
32 12
    public function __construct(array $config)
33
    {
34 12
        $this->name = $config['name'];
35 12
        $this->value = $config['value'];
36 12
        $this->description = isset($config['description']) ? $config['description'] : NULL;
37
38 12
        if (isset($config['deprecationReason'])) {
39 6
            $this->deprecationReason = $config['deprecationReason'];
40 6
        }
41 12
    }
42
43
    /**
44
     * @return string
45
     */
46 36
    public function getName()
47
    {
48 36
        return $this->name;
49
    }
50
51
    /**
52
     * @return string|null
53
     */
54 3
    public function getDescription()
55
    {
56 3
        return $this->description;
57
    }
58
59
    /**
60
     * @return mixed
61
     */
62 6
    public function getValue()
63
    {
64 6
        return $this->value;
65
    }
66
67
    /**
68
     * @return string|null
69
     */
70 12
    public function getDeprecationReason()
71
    {
72 12
        return $this->deprecationReason;
73
    }
74
}
75