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

NameNode::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Digia\GraphQL\Language\Node;
4
5
use Digia\GraphQL\Language\Location;
6
7
class NameNode extends AbstractNode
8
{
9
    use ValueTrait;
10
11
    /**
12
     * @var string
13
     */
14
    protected $kind = NodeKindEnum::NAME;
15
16
    /**
17
     * NameNode constructor.
18
     *
19
     * @param mixed         $value
20
     * @param Location|null $location
21
     */
22
    public function __construct($value, ?Location $location)
23
    {
24
        parent::__construct(NodeKindEnum::NAME, $location);
25
26
        $this->value = $value;
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function toAST(): array
33
    {
34
        return [
35
            'kind'  => $this->kind,
36
            'value' => $this->value,
37
            'loc'   => $this->getLocationAST(),
38
        ];
39
    }
40
}
41