Automattic\WooCommerce\Vendor\GraphQL\Validator\Rules

QueryComplexity::buildFieldArgumentsprotectedWC 1.0

Method of the class: QueryComplexity{}

No Hooks.

Returns

Array. mixed>

Usage

// protected - for code of main (parent) or child class
$result = $this->buildFieldArguments( $node ): array;
$node(FieldNode) (required)
.

QueryComplexity::buildFieldArguments() code WC 10.9.1

protected function buildFieldArguments(FieldNode $node): array
{
    $rawVariableValues = $this->getRawVariableValues();
    $fieldDef = $this->fieldDefinition($node);

    /** @var array<string, mixed> $args */
    $args = [];

    if ($fieldDef instanceof FieldDefinition) {
        [$errors, $variableValues] = Values::getVariableValues(
            $this->context->getSchema(),
            $this->variableDefs,
            $rawVariableValues
        );

        if (is_array($errors) && $errors !== []) {
            throw new Error(implode("\n\n", array_map(static fn ($error) => $error->getMessage(), $errors)));
        }

        $args = Values::getArgumentValues($fieldDef, $node, $variableValues);
    }

    return $args;
}