vendor/overblog/graphql-bundle/src/Event/ExecutorArgumentsEvent.php line 30

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