Automattic\WooCommerce\Vendor\GraphQL\Type
SchemaValidationContext::getAllImplementsInterfaceNodes
Method of the class: SchemaValidationContext{}
No Hooks.
Returns
list
Usage
// private - for code of main (parent) class only $result = $this->getAllImplementsInterfaceNodes( $type, $shouldBeInterface ): array;
- $type(ObjectType|InterfaceType) (required)
- .
- $shouldBeInterface(Type&NamedType) (required)
- .
SchemaValidationContext::getAllImplementsInterfaceNodes() SchemaValidationContext::getAllImplementsInterfaceNodes code WC 10.9.1
private function getAllImplementsInterfaceNodes(ImplementingType $type, NamedType $shouldBeInterface): array
{
$allNodes = array_filter([$type->astNode, ...$type->extensionASTNodes]);
$shouldBeInterfaceName = $shouldBeInterface->name;
$matchingInterfaceNodes = [];
foreach ($allNodes as $node) {
foreach ($node->interfaces as $interface) {
if ($interface->name->value === $shouldBeInterfaceName) {
$matchingInterfaceNodes[] = $interface;
}
}
}
return $matchingInterfaceNodes;
}