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);
    }
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);
    }
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 ) ; }
This filter replaces the given words with a replacement character.

@param mixed          $value       The raw input to run the filter against.
@param array|callable $words       The words to filter out.
@param string         $replacement The character to replace the words with.

@return string|null

@throws FilterException Thrown when a bad value is encountered.
This filter replaces the given words with a replacement character .