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

ScalarTypeExtensionNode::toAST()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
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