Automattic\WooCommerce\Api\Infrastructure

QueryInfoExtractor::extract_from_infopublic staticWC 1.0

Extract query info from a resolver's ResolveInfo and top-level args.

Method of the class: QueryInfoExtractor{}

No Hooks.

Returns

array. The unified query info tree.

Usage

$result = QueryInfoExtractor::extract_from_info( $info, $args ): array;
$info(ResolveInfo) (required)
The GraphQL resolve info.
$args(array) (required)
The top-level query arguments.

QueryInfoExtractor::extract_from_info() code WC 11.0.1

public static function extract_from_info( ResolveInfo $info, array $args ): array {
	$result = self::extract( $info->fieldNodes[0]->selectionSet ?? null, $info->variableValues, $info->fragments );
	if ( ! empty( $args ) ) {
		$result['__args'] = $args;
	}
	return $result;
}