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

FragmentSpreadNode   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A toAST() 0 8 1
1
<?php
2
3
namespace Digia\GraphQL\Language\Node;
4
5
use Digia\GraphQL\Language\Location;
6
7
class FragmentSpreadNode extends AbstractNode implements FragmentNodeInterface, NameAwareInterface,
8
    SelectionNodeInterface
9
{
10
    use NameTrait;
11
    use DirectivesTrait;
12
    use SelectionSetTrait;
13
14
    /**
15
     * FragmentSpreadNode constructor.
16
     *
17
     * @param NameNode              $name
18
     * @param DirectiveNode[]       $directives
19
     * @param SelectionSetNode|null $selectionSet
20
     * @param Location|null         $location
21
     */
22
    public function __construct(
23
        NameNode $name,
24
        array $directives,
25
        ?SelectionSetNode $selectionSet,
26
        ?Location $location
27
    ) {
28
        parent::__construct(NodeKindEnum::FRAGMENT_SPREAD, $location);
29
30
        $this->name         = $name;
31
        $this->directives   = $directives;
32
        $this->selectionSet = $selectionSet;
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function toAST(): array
39
    {
40
        return [
41
            'kind'         => $this->kind,
42
            'name'         => $this->getNameAST(),
43
            'directives'   => $this->getDirectivesAST(),
44
            'selectionSet' => $this->getSelectionSetAST(),
45
            'loc'          => $this->getLocationAST(),
46
        ];
47
    }
48
}
49