private function sanitizeField(array $data, string $field, $ruleset): string
    {
        if (! \is_string($ruleset) && ! \is_array($ruleset)) {
            throw new InvalidArgumentException(\sprintf(
                'The ruleset parameter must be of type string or array, [%s] given.',
                \is_object($ruleset) ? \get_class($ruleset) : \gettype($ruleset)
            ));
        }

        // If we have a piped ruleset, explode it.
        if (\is_string($ruleset)) {
            $ruleset = \explode('|', $ruleset);
        }

        // Get value from data array.
        $value = $data[$field];

        foreach ($ruleset as $rule) {
            $parametersSet = [];

            if (\strpos($rule, ':') !== false) {
                [$rule, $parameters] = \explode(':', $rule);

                $parametersSet = \explode(',', $parameters);
            }

            \array_unshift($parametersSet, $value);

            $sanitizers = $rule;

            // Retrieve a sanitizer by key.
            if (isset($this->sanitizers[$rule])) {
                $sanitizers = $this->sanitizers[$rule];
            }

            // Execute the sanitizer to mutate the value.
            $value = $this->executeSanitizer($sanitizers, $parametersSet);
        }

        return $value;
    }