Executor
in package
Implements the "Evaluating requests" section of the Automattic\WooCommerce\Vendor\GraphQL specification.
Tags
Table of Contents
- $defaultArgsMapper : callable
- $defaultFieldResolver : callable
- $defaultPromiseAdapter : PromiseAdapter|null
- $implementationFactory : callable
- defaultArgsMapper() : T
- defaultFieldResolver() : mixed
- If a resolve function is not given, then a default resolve behavior is used which takes the property of the root value of the same name as the field and returns it as the result, or if it's a function, returns the result of calling that function while passing along args and context.
- execute() : ExecutionResult
- Executes DocumentNode against given $schema.
- getDefaultArgsMapper() : callable
- getDefaultFieldResolver() : callable
- getDefaultPromiseAdapter() : PromiseAdapter
- getImplementationFactory() : callable
- promiseToExecute() : Promise
- Same as execute(), but requires promise adapter and returns a promise which is always fulfilled with an instance of ExecutionResult and never rejected.
- setDefaultArgsMapper() : void
- setDefaultFieldResolver() : void
- Set a custom default resolve function.
- setDefaultPromiseAdapter() : void
- Set a custom default promise adapter.
- setImplementationFactory() : void
- Set a custom executor implementation factory.
Properties
$defaultArgsMapper
private
static callable
$defaultArgsMapper
= [self::class, 'defaultArgsMapper']
Tags
$defaultFieldResolver
private
static callable
$defaultFieldResolver
= [self::class, 'defaultFieldResolver']
Tags
$defaultPromiseAdapter
private
static PromiseAdapter|null
$defaultPromiseAdapter
$implementationFactory
private
static callable
$implementationFactory
= [AutomatticWooCommerceVendorGraphQLExecutorReferenceExecutor::class, 'create']
Tags
Methods
defaultArgsMapper()
public
static defaultArgsMapper(T $args) : T
Parameters
- $args : T
Tags
Return values
T —defaultFieldResolver()
If a resolve function is not given, then a default resolve behavior is used which takes the property of the root value of the same name as the field and returns it as the result, or if it's a function, returns the result of calling that function while passing along args and context.
public
static defaultFieldResolver(mixed $objectLikeValue, array<string, mixed> $args, mixed $contextValue, ResolveInfo $info) : mixed
Parameters
- $objectLikeValue : mixed
- $args : array<string, mixed>
- $contextValue : mixed
- $info : ResolveInfo
Return values
mixed —execute()
Executes DocumentNode against given $schema.
public
static execute(Schema $schema, DocumentNode $documentNode[, mixed $rootValue = null ][, mixed $contextValue = null ][, array<string, mixed>|null $variableValues = null ][, string|null $operationName = null ][, callable|null $fieldResolver = null ]) : ExecutionResult
Always returns ExecutionResult and never throws.
All errors which occur during operation execution are collected in $result->errors.
Parameters
- $schema : Schema
- $documentNode : DocumentNode
- $rootValue : mixed = null
- $contextValue : mixed = null
- $variableValues : array<string, mixed>|null = null
- $operationName : string|null = null
- $fieldResolver : callable|null = null
Tags
Return values
ExecutionResult —getDefaultArgsMapper()
public
static getDefaultArgsMapper() : callable
Tags
Return values
callable —getDefaultFieldResolver()
public
static getDefaultFieldResolver() : callable
Tags
Return values
callable —getDefaultPromiseAdapter()
public
static getDefaultPromiseAdapter() : PromiseAdapter
Return values
PromiseAdapter —getImplementationFactory()
public
static getImplementationFactory() : callable
Tags
Return values
callable —promiseToExecute()
Same as execute(), but requires promise adapter and returns a promise which is always fulfilled with an instance of ExecutionResult and never rejected.
public
static promiseToExecute(PromiseAdapter $promiseAdapter, Schema $schema, DocumentNode $documentNode[, mixed $rootValue = null ][, mixed $contextValue = null ][, array<string, mixed>|null $variableValues = null ][, string|null $operationName = null ][, callable|null $fieldResolver = null ][, callable|null $argsMapper = null ]) : Promise
Useful for async PHP platforms.
Parameters
- $promiseAdapter : PromiseAdapter
- $schema : Schema
- $documentNode : DocumentNode
- $rootValue : mixed = null
- $contextValue : mixed = null
- $variableValues : array<string, mixed>|null = null
- $operationName : string|null = null
- $fieldResolver : callable|null = null
- $argsMapper : callable|null = null
Tags
Return values
Promise —setDefaultArgsMapper()
public
static setDefaultArgsMapper(callable $argsMapper) : void
Parameters
- $argsMapper : callable
Tags
Return values
void —setDefaultFieldResolver()
Set a custom default resolve function.
public
static setDefaultFieldResolver(callable $fieldResolver) : void
Parameters
- $fieldResolver : callable
Tags
Return values
void —setDefaultPromiseAdapter()
Set a custom default promise adapter.
public
static setDefaultPromiseAdapter([PromiseAdapter|null $defaultPromiseAdapter = null ]) : void
Parameters
- $defaultPromiseAdapter : PromiseAdapter|null = null
Return values
void —setImplementationFactory()
Set a custom executor implementation factory.
public
static setImplementationFactory(callable $implementationFactory) : void
Parameters
- $implementationFactory : callable
