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

DocumentBuilder::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
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\DefinitionNodeInterface;
6
use Digia\GraphQL\Language\AST\Node\Contract\NodeInterface;
7
use Digia\GraphQL\Language\AST\Node\DocumentNode;
8
use Digia\GraphQL\Language\AST\NodeKindEnum;
9
10
class DocumentBuilder extends AbstractBuilder
11
{
12
13
    /**
14
     * @inheritdoc
15
     */
16
    public function build(array $ast): NodeInterface
17
    {
18
        return new DocumentNode([
19
            'definitions' => $this->buildMany($ast, 'definitions'),
20
            'location'    => $this->createLocation($ast),
21
        ]);
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function supportsKind(string $kind): bool
28
    {
29
        return $kind === NodeKindEnum::DOCUMENT;
30
    }
31
}
32