vendor/overblog/graphql-bundle/src/Executor/Executor.php line 43

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Overblog\GraphQLBundle\Executor;
  4. use GraphQL\Executor\ExecutionResult;
  5. use GraphQL\Executor\Promise\PromiseAdapter;
  6. use GraphQL\GraphQL;
  7. use GraphQL\Type\Schema;
  8. use Overblog\GraphQLBundle\Executor\Promise\PromiseAdapterInterface;
  9. use RuntimeException;
  10. use function func_get_args;
  11. use function method_exists;
  12. use function sprintf;
  13. class Executor implements ExecutorInterface
  14. {
  15.     /**
  16.      * {@inheritdoc}
  17.      */
  18.     public function execute(
  19.         PromiseAdapter $promiseAdapter,
  20.         Schema $schema,
  21.         string $requestString,
  22.         $rootValue null,
  23.         $contextValue null,
  24.         $variableValues null,
  25.         $operationName null,
  26.         ?callable $fieldResolver null,
  27.         ?array $validationRules null
  28.     ): ExecutionResult {
  29.         if (!method_exists($promiseAdapter'wait')) {
  30.             throw new RuntimeException(
  31.                 sprintf(
  32.                     'PromiseAdapter should be an object instantiating "%s" or "%s" with a "wait" method.',
  33.                     PromiseAdapterInterface::class,
  34.                     PromiseAdapter::class
  35.                 )
  36.             );
  37.         }
  38.         return $promiseAdapter->wait(GraphQL::promiseToExecute(...func_get_args()));
  39.     }
  40. }