Automattic\WooCommerce\Vendor\GraphQL\Utils
SchemaPrinter::printInputValue
Method of the class: SchemaPrinter{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = SchemaPrinter::printInputValue( $arg ): string;
- $arg(InputObjectField|Argument) (required)
- .
SchemaPrinter::printInputValue() SchemaPrinter::printInputValue code WC 10.9.1
protected static function printInputValue($arg): string
{
$argDecl = "{$arg->name}: {$arg->getType()->toString()}";
if ($arg->defaultValueExists()) {
$defaultValueAST = AST::astFromValue($arg->defaultValue, $arg->getType());
if ($defaultValueAST === null) {
$inconvertibleDefaultValue = Utils::printSafe($arg->defaultValue);
throw new InvariantViolation("Unable to convert defaultValue of argument {$arg->name} into AST: {$inconvertibleDefaultValue}.");
}
$printedDefaultValue = Printer::doPrint($defaultValueAST);
$argDecl .= " = {$printedDefaultValue}";
}
return $argDecl . static::printDeprecated($arg);
}