Automattic\WooCommerce\Vendor\GraphQL\Executor
ReferenceExecutor::doesFragmentConditionMatch
Determines if a fragment is applicable to the given type.
Method of the class: ReferenceExecutor{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->doesFragmentConditionMatch( $fragment, $type ): bool;
- $fragment(FragmentDefinitionNode|InlineFragmentNode) (required)
- .
- $type(ObjectType) (required)
- .
ReferenceExecutor::doesFragmentConditionMatch() ReferenceExecutor::doesFragmentConditionMatch code WC 10.9.1
protected function doesFragmentConditionMatch(Node $fragment, ObjectType $type): bool
{
$typeConditionNode = $fragment->typeCondition;
if ($typeConditionNode === null) {
return true;
}
$conditionalType = AST::typeFromAST([$this->exeContext->schema, 'getType'], $typeConditionNode);
if ($conditionalType === $type) {
return true;
}
if ($conditionalType instanceof AbstractType) {
return $this->exeContext->schema->isSubType($conditionalType, $type);
}
return false;
}