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

ScalarTypeExtensionNode   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

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

2 Methods

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