Automattic\WooCommerce\Vendor\GraphQL\Executor
ReferenceExecutor::completeAbstractValue
Complete a value of an abstract type by determining the runtime object type of that value, then complete the value for that type.
Method of the class: ReferenceExecutor{}
No Hooks.
Returns
Array
Usage
// protected - for code of main (parent) or child class $result = $this->completeAbstractValue( $returnType, $fieldNodes, $info, $path, $unaliasedPath, $result, $contextValue );
- $returnType(AbstractType&Type) (required)
- .
- $fieldNodes(ArrayObject) (required)
- .
- $info(ResolveInfo) (required)
- .
- $path(list<string|int>) (required)
- .
- $unaliasedPath(list<string|int>) (required)
- .
- $result(mixed) (required)
- .
- $contextValue(mixed) (required)
- .
ReferenceExecutor::completeAbstractValue() ReferenceExecutor::completeAbstractValue code WC 10.9.1
protected function completeAbstractValue(
AbstractType $returnType,
\ArrayObject $fieldNodes,
ResolveInfo $info,
array $path,
array $unaliasedPath,
$result,
$contextValue
) {
$result = $returnType->resolveValue($result, $contextValue, $info);
$typeCandidate = $returnType->resolveType($result, $contextValue, $info);
if ($typeCandidate === null) {
$runtimeType = static::defaultTypeResolver($result, $contextValue, $info, $returnType);
} elseif (! is_string($typeCandidate) && is_callable($typeCandidate)) {
$runtimeType = $typeCandidate();
} else {
$runtimeType = $typeCandidate;
}
$promise = $this->getPromise($runtimeType);
if ($promise !== null) {
return $promise->then(fn ($resolvedRuntimeType) => $this->completeObjectValue(
$this->ensureValidRuntimeType(
$resolvedRuntimeType,
$returnType,
$info,
$result
),
$fieldNodes,
$info,
$path,
$unaliasedPath,
$result,
$contextValue
));
}
return $this->completeObjectValue(
$this->ensureValidRuntimeType(
$runtimeType,
$returnType,
$info,
$result
),
$fieldNodes,
$info,
$path,
$unaliasedPath,
$result,
$contextValue
);
}