1
|
|
|
<?php |
2
|
|
|
/******************************************************************************* |
3
|
|
|
* This file is part of the GraphQL Bundle package. |
4
|
|
|
* |
5
|
|
|
* (c) YnloUltratech <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
******************************************************************************/ |
10
|
|
|
|
11
|
|
|
namespace Ynlo\GraphQLBundle\Request; |
12
|
|
|
|
13
|
|
|
class ExecuteQuery |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* A GraphQL language formatted string representing the requested operation. |
17
|
|
|
* |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
protected $requestString = ''; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* The name of the operation to use if requestString contains multiple |
24
|
|
|
* possible operations. Can be omitted if requestString contains only |
25
|
|
|
* one operation. |
26
|
|
|
* |
27
|
|
|
* @var string|null |
28
|
|
|
*/ |
29
|
|
|
protected $operationName; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* A mapping of variable name to runtime value to use for all variables |
33
|
|
|
* defined in the requestString. |
34
|
|
|
* |
35
|
|
|
* @var array |
36
|
|
|
*/ |
37
|
|
|
protected $variables = []; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return string |
41
|
|
|
*/ |
42
|
22 |
|
public function getRequestString(): string |
43
|
|
|
{ |
44
|
22 |
|
return $this->requestString; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param string $requestString |
49
|
|
|
* |
50
|
|
|
* @return ExecuteQuery |
51
|
|
|
*/ |
52
|
22 |
|
public function setRequestString(string $requestString): ExecuteQuery |
53
|
|
|
{ |
54
|
22 |
|
$this->requestString = $requestString; |
55
|
|
|
|
56
|
22 |
|
return $this; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return null|string |
61
|
|
|
*/ |
62
|
22 |
|
public function getOperationName(): ?string |
63
|
|
|
{ |
64
|
22 |
|
return $this->operationName; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param null|string $operationName |
69
|
|
|
* |
70
|
|
|
* @return ExecuteQuery |
71
|
|
|
*/ |
72
|
|
|
public function setOperationName(?string $operationName): ExecuteQuery |
73
|
|
|
{ |
74
|
|
|
$this->operationName = $operationName; |
75
|
|
|
|
76
|
|
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return array |
81
|
|
|
*/ |
82
|
22 |
|
public function getVariables(): array |
83
|
|
|
{ |
84
|
22 |
|
return $this->variables; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param array $variables |
89
|
|
|
* |
90
|
|
|
* @return ExecuteQuery |
91
|
|
|
*/ |
92
|
22 |
|
public function setVariables(array $variables): ExecuteQuery |
93
|
|
|
{ |
94
|
22 |
|
$this->variables = $variables; |
95
|
|
|
|
96
|
22 |
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* {@inheritdoc} |
101
|
|
|
*/ |
102
|
|
|
public function __toString() |
103
|
|
|
{ |
104
|
|
|
return $this->requestString; |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|