Completed
Pull Request — master (#19)
by Christoffer
02:01
created

ScalarTypeExtensionBuilder::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\GraphQL\Language\AST\Node\Builder;
4
5
use Digia\GraphQL\Language\AST\Node\Contract\NodeInterface;
6
use Digia\GraphQL\Language\AST\Node\ScalarTypeDefinitionNode;
7
use Digia\GraphQL\Language\AST\Node\ScalarTypeExtensionNode;
8
use Digia\GraphQL\Language\AST\NodeKindEnum;
9
10
class ScalarTypeExtensionBuilder extends AbstractBuilder
11
{
12
13
    /**
14
     * @inheritdoc
15
     */
16
    public function build(array $ast): NodeInterface
17
    {
18
        return new ScalarTypeExtensionNode([
19
            'name'        => $this->buildOne($ast, 'name'),
20
            'directives'  => $this->buildMany($ast, 'directives'),
21
            'location'    => $this->createLocation($ast),
22
        ]);
23
    }
24
25
    /**
26
     * @inheritdoc
27
     */
28
    public function supportsKind(string $kind): bool
29
    {
30
        return $kind === NodeKindEnum::SCALAR_TYPE_EXTENSION;
31
    }
32
}
33