1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Overblog\GraphQLBundle\Event; |
6
|
|
|
|
7
|
|
|
use Overblog\GraphQLBundle\Definition\Type\ExtensibleSchema; |
8
|
|
|
use Symfony\Contracts\EventDispatcher\Event; |
9
|
|
|
|
10
|
|
|
final class ExecutorArgumentsEvent extends Event |
11
|
|
|
{ |
12
|
|
|
/** @var ExtensibleSchema */ |
13
|
|
|
private $schema; |
14
|
|
|
|
15
|
|
|
/** @var string */ |
16
|
|
|
private $requestString; |
17
|
|
|
|
18
|
|
|
/** @var mixed */ |
19
|
|
|
private $rootValue; |
20
|
|
|
|
21
|
|
|
/** @var \ArrayObject */ |
22
|
|
|
private $contextValue; |
23
|
|
|
|
24
|
|
|
/** @var array|null */ |
25
|
|
|
private $variableValue; |
26
|
|
|
|
27
|
|
|
/** @var string|null */ |
28
|
|
|
private $operationName; |
29
|
|
|
|
30
|
103 |
|
public static function create( |
31
|
|
|
ExtensibleSchema $schema, |
32
|
|
|
$requestString, |
33
|
|
|
\ArrayObject $contextValue, |
34
|
|
|
$rootValue = null, |
35
|
|
|
array $variableValue = null, |
36
|
|
|
$operationName = null |
37
|
|
|
) { |
38
|
103 |
|
$instance = new static(); |
39
|
103 |
|
$instance->setSchema($schema); |
40
|
103 |
|
$instance->setRequestString($requestString); |
41
|
103 |
|
$instance->setContextValue($contextValue); |
42
|
103 |
|
$instance->setRootValue($rootValue); |
43
|
103 |
|
$instance->setVariableValue($variableValue); |
44
|
103 |
|
$instance->setOperationName($operationName); |
45
|
|
|
|
46
|
103 |
|
return $instance; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param string|null $operationName |
51
|
|
|
*/ |
52
|
103 |
|
public function setOperationName($operationName = null): void |
53
|
|
|
{ |
54
|
103 |
|
$this->operationName = $operationName; |
55
|
103 |
|
} |
56
|
|
|
|
57
|
103 |
|
public function setContextValue(\ArrayObject $contextValue = null): void |
58
|
|
|
{ |
59
|
103 |
|
$this->contextValue = $contextValue; |
60
|
103 |
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param mixed $rootValue |
64
|
|
|
*/ |
65
|
103 |
|
public function setRootValue($rootValue = null): void |
66
|
|
|
{ |
67
|
103 |
|
$this->rootValue = $rootValue; |
68
|
103 |
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $requestString |
72
|
|
|
*/ |
73
|
103 |
|
public function setRequestString($requestString): void |
74
|
|
|
{ |
75
|
103 |
|
$this->requestString = $requestString; |
76
|
103 |
|
} |
77
|
|
|
|
78
|
103 |
|
public function setVariableValue(array $variableValue = null): void |
79
|
|
|
{ |
80
|
103 |
|
$this->variableValue = $variableValue; |
81
|
103 |
|
} |
82
|
|
|
|
83
|
103 |
|
public function setSchema(ExtensibleSchema $schema): void |
84
|
|
|
{ |
85
|
103 |
|
$this->schema = $schema; |
86
|
103 |
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return ExtensibleSchema |
90
|
|
|
*/ |
91
|
103 |
|
public function getSchema(): ExtensibleSchema |
92
|
|
|
{ |
93
|
103 |
|
return $this->schema; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
103 |
|
public function getRequestString(): string |
100
|
|
|
{ |
101
|
103 |
|
return $this->requestString; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return array|null |
106
|
|
|
*/ |
107
|
103 |
|
public function getRootValue() |
108
|
|
|
{ |
109
|
103 |
|
return $this->rootValue; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return \ArrayObject |
114
|
|
|
*/ |
115
|
103 |
|
public function getContextValue(): \ArrayObject |
116
|
|
|
{ |
117
|
103 |
|
return $this->contextValue; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return array|null |
122
|
|
|
*/ |
123
|
103 |
|
public function getVariableValue() |
124
|
|
|
{ |
125
|
103 |
|
return $this->variableValue; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return string|null |
130
|
|
|
*/ |
131
|
103 |
|
public function getOperationName() |
132
|
|
|
{ |
133
|
103 |
|
return $this->operationName; |
134
|
|
|
} |
135
|
|
|
} |
136
|
|
|
|