Automattic\WooCommerce\Vendor\GraphQL\Utils

SchemaExtender::extendImplementedInterfacesprotectedWC 1.0

Method of the class: SchemaExtender{}

No Hooks.

Returns

Array. InterfaceType>

Usage

// protected - for code of main (parent) or child class
$result = $this->extendImplementedInterfaces( $type ): array;
$type(ObjectType|InterfaceType) (required)
.

SchemaExtender::extendImplementedInterfaces() code WC 10.9.1

protected function extendImplementedInterfaces(ImplementingType $type): array
{
    $interfaces = array_map(
        [$this, 'extendNamedType'],
        $type->getInterfaces()
    );

    if (isset($this->typeExtensionsMap[$type->name])) {
        foreach ($this->typeExtensionsMap[$type->name] as $extension) {
            assert(
                $extension instanceof ObjectTypeExtensionNode || $extension instanceof InterfaceTypeExtensionNode,
                'proven by schema validation'
            );

            foreach ($extension->interfaces as $namedType) {
                $interface = $this->astBuilder->buildType($namedType);
                assert($interface instanceof InterfaceType, 'we know this, but PHP templates cannot express it');

                $interfaces[] = $interface;
            }
        }
    }

    return $interfaces;
}