src/Viserio/Component/Validation/Sanitizer.php
public function sanitize(array $rules, array $data): array
    {
        [$data, $rules] = $this->runGlobalSanitizers($rules, $data);

        $availableRules = \array_intersect_key($rules, \array_flip(array_keys($data)));

        foreach ($availableRules as $field => $ruleset) {
            $data[$field] = $this->sanitizeField($data, $field, $ruleset);
        }

        return $data;
    }
public function sanitize(array $rules, array $data): array
    {
        [$data, $rules] = $this->runGlobalSanitizers($rules, $data);

        $availableRules = \array_intersect_key($rules, \array_flip(array_keys($data)));

        foreach ($availableRules as $field => $ruleset) {
            $data[$field] = $this->sanitizeField($data, $field, $ruleset);
        }

        return $data;
    }
Sanitize a dataset using rules.

@param array $rules
@param array $data

@return array