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