public static function redact(
        $value,
        $words,
        string $replacement = ''
    ) {
        if ($value === null || $value === '') {
            return $value;
        }

        $stringValue = self::filter($value);
        if (is_callable($words)) {
            $words = $words();
        }

        if (is_array($words) === false) {
            throw new FilterException("Words was not an array or a callable that returns an array");
        }

        return self::replaceWordsWithReplacementString($stringValue, $words, $replacement);
    }