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

ObjectFieldNode::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 ObjectFieldNode extends AbstractNode implements NameAwareInterface
8
{
9
    use NameTrait;
10
    use ValueLiteralTrait;
11
12
    /**
13
     * ObjectFieldNode constructor.
14
     *
15
     * @param NameNode                $name
16
     * @param ValueNodeInterface|null $value
17
     * @param Location|null           $location
18
     */
19
    public function __construct(NameNode $name, ?ValueNodeInterface $value, ?Location $location)
20
    {
21
        parent::__construct(NodeKindEnum::OBJECT_FIELD, $location);
22
23
        $this->name  = $name;
24
        $this->value = $value;
25
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30
    public function toAST(): array
31
    {
32
        return [
33
            'kind'  => $this->kind,
34
            'name'  => $this->getNameAST(),
35
            'value' => $this->getValueAST(),
36
            'loc'   => $this->getLocationAST(),
37
        ];
38
    }
39
}
40