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
|
|
|
/** @var float */ |
31
|
|
|
private $startTime; |
32
|
|
|
|
33
|
104 |
|
public static function create( |
34
|
|
|
ExtensibleSchema $schema, |
35
|
|
|
$requestString, |
36
|
|
|
\ArrayObject $contextValue, |
37
|
|
|
$rootValue = null, |
38
|
|
|
array $variableValue = null, |
39
|
|
|
$operationName = null |
40
|
|
|
) { |
41
|
104 |
|
$instance = new static(); |
42
|
104 |
|
$instance->setSchema($schema); |
43
|
104 |
|
$instance->setRequestString($requestString); |
44
|
104 |
|
$instance->setContextValue($contextValue); |
45
|
104 |
|
$instance->setRootValue($rootValue); |
46
|
104 |
|
$instance->setVariableValue($variableValue); |
47
|
104 |
|
$instance->setOperationName($operationName); |
48
|
104 |
|
$instance->setStartTime(\microtime(true)); |
49
|
|
|
|
50
|
104 |
|
return $instance; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param string|null $operationName |
55
|
|
|
*/ |
56
|
104 |
|
public function setOperationName($operationName = null): void |
57
|
|
|
{ |
58
|
104 |
|
$this->operationName = $operationName; |
59
|
104 |
|
} |
60
|
|
|
|
61
|
104 |
|
public function setContextValue(\ArrayObject $contextValue = null): void |
62
|
|
|
{ |
63
|
104 |
|
$this->contextValue = $contextValue; |
64
|
104 |
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param mixed $rootValue |
68
|
|
|
*/ |
69
|
104 |
|
public function setRootValue($rootValue = null): void |
70
|
|
|
{ |
71
|
104 |
|
$this->rootValue = $rootValue; |
72
|
104 |
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @param string $requestString |
76
|
|
|
*/ |
77
|
104 |
|
public function setRequestString($requestString): void |
78
|
|
|
{ |
79
|
104 |
|
$this->requestString = $requestString; |
80
|
104 |
|
} |
81
|
|
|
|
82
|
104 |
|
public function setVariableValue(array $variableValue = null): void |
83
|
|
|
{ |
84
|
104 |
|
$this->variableValue = $variableValue; |
85
|
104 |
|
} |
86
|
|
|
|
87
|
104 |
|
public function setSchema(ExtensibleSchema $schema): void |
88
|
|
|
{ |
89
|
104 |
|
$this->schema = $schema; |
90
|
104 |
|
} |
91
|
|
|
|
92
|
104 |
|
public function setStartTime(float $startTime): void |
93
|
|
|
{ |
94
|
104 |
|
$this->startTime = $startTime; |
95
|
104 |
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @return ExtensibleSchema |
99
|
|
|
*/ |
100
|
103 |
|
public function getSchema(): ExtensibleSchema |
101
|
|
|
{ |
102
|
103 |
|
return $this->schema; |
103
|
|
|
} |
104
|
|
|
|
105
|
104 |
|
public function getRequestString(): string |
106
|
|
|
{ |
107
|
104 |
|
return $this->requestString; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return array|null |
112
|
|
|
*/ |
113
|
103 |
|
public function getRootValue() |
114
|
|
|
{ |
115
|
103 |
|
return $this->rootValue; |
116
|
|
|
} |
117
|
|
|
|
118
|
103 |
|
public function getContextValue(): \ArrayObject |
119
|
|
|
{ |
120
|
103 |
|
return $this->contextValue; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @return array|null |
125
|
|
|
*/ |
126
|
104 |
|
public function getVariableValue() |
127
|
|
|
{ |
128
|
104 |
|
return $this->variableValue; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @return string|null |
133
|
|
|
*/ |
134
|
104 |
|
public function getOperationName() |
135
|
|
|
{ |
136
|
104 |
|
return $this->operationName; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return float|null |
141
|
|
|
*/ |
142
|
104 |
|
public function getStartTime() |
143
|
|
|
{ |
144
|
104 |
|
return $this->startTime; |
145
|
|
|
} |
146
|
|
|
} |
147
|
|
|
|