Automattic\WooCommerce\Api\Infrastructure

QueryInfoExtractor::resolve_argument_valueprivate staticWC 1.0

Resolve the value of a single argument node, handling variables.

Method of the class: QueryInfoExtractor{}

No Hooks.

Returns

mixed. The resolved argument value.

Usage

$result = QueryInfoExtractor::resolve_argument_value( $arg, $variable_values ): mixed;
$arg(ArgumentNode) (required)
The argument node.
$variable_values(array) (required)
Variable values.

QueryInfoExtractor::resolve_argument_value() code WC 11.0.1

private static function resolve_argument_value( ArgumentNode $arg, array $variable_values ): mixed {
	$value_node = $arg->value;

	if ( $value_node instanceof \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\VariableNode ) {
		return $variable_values[ $value_node->name->value ] ?? null;
	}

	return \Automattic\WooCommerce\Vendor\GraphQL\Utils\AST::valueFromASTUntyped( $value_node, $variable_values );
}