Automattic\WooCommerce\Vendor\GraphQL\Utils

BuildClientSchema::buildImplementationsListprivateWC 1.0

Method of the class: BuildClientSchema{}

No Hooks.

Returns

Array. InterfaceType>

Usage

// private - for code of main (parent) class only
$result = $this->buildImplementationsList( $implementingIntrospection ): array;
$implementingIntrospection(array) (required)
.

BuildClientSchema::buildImplementationsList() code WC 10.9.1

private function buildImplementationsList(array $implementingIntrospection): array
{
    // TODO: Temporary workaround until Automattic\WooCommerce\Vendor\GraphQL ecosystem will fully support 'interfaces' on interface types.
    if (
        array_key_exists('interfaces', $implementingIntrospection)
        && $implementingIntrospection['interfaces'] === null
        && $implementingIntrospection['kind'] === TypeKind::INTERFACE
    ) {
        return [];
    }

    if (! array_key_exists('interfaces', $implementingIntrospection)) {
        $safeIntrospection = Utils::printSafeJson($implementingIntrospection);
        throw new InvariantViolation("Introspection result missing interfaces: {$safeIntrospection}.");
    }

    return array_map(
        [$this, 'getInterfaceType'],
        $implementingIntrospection['interfaces']
    );
}