Automattic\WooCommerce\Vendor\GraphQL\Utils

SchemaPrinter::printTypepublic staticWC 1.0

Method of the class: SchemaPrinter{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = SchemaPrinter::printType( $type, $options ): string;
$type(Type) (required)
.
$options(array)
.
Default: []

SchemaPrinter::printType() code WC 10.9.1

public static function printType(Type $type, array $options = []): string
{
    if ($type instanceof ScalarType) {
        return static::printScalar($type, $options);
    }

    if ($type instanceof ObjectType) {
        return static::printObject($type, $options);
    }

    if ($type instanceof InterfaceType) {
        return static::printInterface($type, $options);
    }

    if ($type instanceof UnionType) {
        return static::printUnion($type, $options);
    }

    if ($type instanceof EnumType) {
        return static::printEnum($type, $options);
    }

    if ($type instanceof InputObjectType) {
        return static::printInputObject($type, $options);
    }

    $unknownType = Utils::printSafe($type);
    throw new Error("Unknown type: {$unknownType}.");
}