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

NonNullTypeNode::toAST()   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 0
dl 0
loc 6
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 NonNullTypeNode extends AbstractNode implements TypeNodeInterface
8
{
9
    use TypeTrait;
10
11
    /**
12
     * NonNullTypeNode constructor.
13
     *
14
     * @param TypeNodeInterface $type
15
     * @param Location|null     $location
16
     */
17
    public function __construct(TypeNodeInterface $type, ?Location $location)
18
    {
19
        parent::__construct(NodeKindEnum::NON_NULL_TYPE, $location);
20
21
        $this->type = $type;
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function toAST(): array
28
    {
29
        return [
30
            'kind' => $this->kind,
31
            'type' => $this->getTypeAST(),
32
            'loc'  => $this->getLocationAST(),
33
        ];
34
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39
    public function __toString(): string
40
    {
41
        return (string)$this->type . '!';
42
    }
43
}
44