Passed
Push — master ( 22d357...2883c4 )
by Christoffer
02:52
created

EnumValueNode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A __construct() 0 5 1
A toAST() 0 5 1
1
<?php
2
3
namespace Digia\GraphQL\Language\Node;
4
5
use Digia\GraphQL\Language\Location;
6
7
class EnumValueNode extends AbstractNode implements ValueNodeInterface
8
{
9
    use ValueTrait;
10
11
    /**
12
     * EnumValueNode constructor.
13
     *
14
     * @param mixed         $value
15
     * @param Location|null $location
16
     */
17
    public function __construct($value, ?Location $location)
18
    {
19
        parent::__construct(NodeKindEnum::ENUM, $location);
20
21
        $this->value = $value;
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function __toString(): string
28
    {
29
        return (string)$this->value;
30
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function toAST(): array
36
    {
37
        return [
38
            'kind'  => $this->kind,
39
            'value' => $this->value,
40
        ];
41
    }
42
}
43