|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Digia\GraphQL\Language\Node; |
|
4
|
|
|
|
|
5
|
|
|
use Digia\GraphQL\Language\Location; |
|
6
|
|
|
|
|
7
|
|
|
class InputValueDefinitionNode extends AbstractNode implements DefinitionNodeInterface, DirectivesAwareInterface, |
|
8
|
|
|
NameAwareInterface |
|
9
|
|
|
{ |
|
10
|
|
|
use DescriptionTrait; |
|
11
|
|
|
use NameTrait; |
|
12
|
|
|
use TypeTrait; |
|
13
|
|
|
use DefaultValueTrait; |
|
14
|
|
|
use DirectivesTrait; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* InputValueDefinitionNode constructor. |
|
18
|
|
|
* |
|
19
|
|
|
* @param StringValueNode|null $description |
|
20
|
|
|
* @param NameNode $name |
|
21
|
|
|
* @param TypeNodeInterface $type |
|
22
|
|
|
* @param ValueNodeInterface|null $defaultValue |
|
23
|
|
|
* @param DirectiveNode[] $directives |
|
24
|
|
|
* @param Location|null $location |
|
25
|
|
|
*/ |
|
26
|
|
|
public function __construct( |
|
27
|
|
|
?StringValueNode $description, |
|
28
|
|
|
NameNode $name, |
|
29
|
|
|
TypeNodeInterface $type, |
|
30
|
|
|
?ValueNodeInterface $defaultValue, |
|
31
|
|
|
array $directives, |
|
32
|
|
|
?Location $location |
|
33
|
|
|
) { |
|
34
|
|
|
parent::__construct(NodeKindEnum::INPUT_VALUE_DEFINITION, $location); |
|
35
|
|
|
|
|
36
|
|
|
$this->description = $description; |
|
37
|
|
|
$this->name = $name; |
|
38
|
|
|
$this->type = $type; |
|
39
|
|
|
$this->defaultValue = $defaultValue; |
|
40
|
|
|
$this->directives = $directives; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @inheritdoc |
|
45
|
|
|
*/ |
|
46
|
|
|
public function toAST(): array |
|
47
|
|
|
{ |
|
48
|
|
|
return [ |
|
49
|
|
|
'kind' => $this->kind, |
|
50
|
|
|
'description' => $this->getDescriptionAST(), |
|
51
|
|
|
'name' => $this->getNameAST(), |
|
52
|
|
|
'type' => $this->getTypeAST(), |
|
53
|
|
|
'defaultValue' => $this->getDefaultValueAST(), |
|
54
|
|
|
'directives' => $this->getDirectivesAST(), |
|
55
|
|
|
'loc' => $this->getLocationAST(), |
|
56
|
|
|
]; |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|