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

EnumTypeExtensionNode   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A toAST() 0 8 1
1
<?php
2
3
namespace Digia\GraphQL\Language\Node;
4
5
use Digia\GraphQL\Language\Location;
6
7
class EnumTypeExtensionNode extends AbstractNode implements TypeExtensionNodeInterface, DirectivesAwareInterface,
8
    NameAwareInterface
9
{
10
    use NameTrait;
11
    use DirectivesTrait;
12
    use EnumValuesTrait;
13
14
    /**
15
     * EnumTypeExtensionNode constructor.
16
     *
17
     * @param NameNode                  $name
18
     * @param DirectiveNode[]           $directives
19
     * @param EnumValueDefinitionNode[] $values
20
     * @param Location|null             $location
21
     */
22
    public function __construct(NameNode $name, array $directives, array $values, ?Location $location)
23
    {
24
        parent::__construct(NodeKindEnum::ENUM_TYPE_EXTENSION, $location);
25
26
        $this->name       = $name;
27
        $this->directives = $directives;
28
        $this->values     = $values;
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function toAST(): array
35
    {
36
        return [
37
            'kind'       => $this->kind,
38
            'name'       => $this->getNameAST(),
39
            'directives' => $this->getDirectivesAST(),
40
            'values'     => $this->getValuesAST(),
41
            'loc'        => $this->getLocationAST(),
42
        ];
43
    }
44
}
45