Automattic\WooCommerce\Vendor\GraphQL\Utils

BuildClientSchema::buildTypeprivateWC 1.0

Method of the class: BuildClientSchema{}

No Hooks.

Returns

Type&NamedType.

Usage

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

BuildClientSchema::buildType() code WC 10.9.1

private function buildType(array $type): NamedType
{
    if (! array_key_exists('kind', $type)) {
        throw self::invalidOrIncompleteIntrospectionResult($type);
    }

    switch ($type['kind']) {
        case TypeKind::SCALAR:
            return $this->buildScalarDef($type);
        case TypeKind::OBJECT:
            return $this->buildObjectDef($type);
        case TypeKind::INTERFACE:
            return $this->buildInterfaceDef($type);
        case TypeKind::UNION:
            return $this->buildUnionDef($type);
        case TypeKind::ENUM:
            return $this->buildEnumDef($type);
        case TypeKind::INPUT_OBJECT:
            return $this->buildInputObjectDef($type);
        default:
            $unknownKindType = Utils::printSafeJson($type);
            throw new InvariantViolation("Invalid or incomplete introspection result. Received type with unknown kind: {$unknownKindType}.");
    }
}