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

EnumValueDefinitionNode::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace Digia\GraphQL\Language\Node;
4
5
use Digia\GraphQL\Language\Location;
6
7
class EnumValueDefinitionNode extends AbstractNode implements DefinitionNodeInterface, DirectivesAwareInterface,
8
    NameAwareInterface
9
{
10
    use DescriptionTrait;
11
    use NameTrait;
12
    use DirectivesTrait;
13
14
    /**
15
     * EnumValueDefinitionNode constructor.
16
     *
17
     * @param StringValueNode|null $description
18
     * @param NameNode             $name
19
     * @param DirectiveNode[]      $directives
20
     * @param Location|null        $location
21
     */
22
    public function __construct(
23
        ?StringValueNode $description,
24
        NameNode $name,
25
        array $directives,
26
        ?Location $location
27
    ) {
28
        parent::__construct(NodeKindEnum::ENUM_VALUE_DEFINITION, $location);
29
30
        $this->description = $description;
31
        $this->name        = $name;
32
        $this->directives  = $directives;
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function toAST(): array
39
    {
40
        return [
41
            'kind'        => $this->kind,
42
            'description' => $this->getDescriptionAST(),
43
            'name'        => $this->getNameAST(),
44
            'directives'  => $this->getDirectivesAST(),
45
            'loc'         => $this->getLocationAST(),
46
        ];
47
    }
48
}
49