exceptionFormatter = $exceptionFormatter; $this->queryComplexityLimiter = $queryComplexityLimiter; } /** * Process a GraphQl query according to defined schema * * @param Schema $schema * @param string $source * @param ContextInterface $contextValue * @param array|null $variableValues * @param string|null $operationName * @return Promise|array */ public function process( Schema $schema, string $source, ContextInterface $contextValue = null, array $variableValues = null, string $operationName = null ) : array { if (!$this->exceptionFormatter->shouldShowDetail()) { $this->queryComplexityLimiter->execute(); } $rootValue = null; return \GraphQL\GraphQL::executeQuery( $schema, $source, $rootValue, $contextValue, $variableValues, $operationName )->toArray( $this->exceptionFormatter->shouldShowDetail() ? \GraphQL\Error\Debug::INCLUDE_DEBUG_MESSAGE : false ); } }