src/Twig/Extension/StringTwigExtension.php
public function antispam(string $string, bool $html = true): string
    {
        if ($html) {
            return preg_replace_callback(self::MAIL_HTML_PATTERN, [$this, 'encryptMail'], $string) ?: '';
        }

        return preg_replace_callback(self::MAIL_TEXT_PATTERN, [$this, 'encryptMailText'], $string) ?: '';
    }
public function antispam(string $string, bool $html = true): string
    {
        if ($html) {
            return preg_replace_callback(self::MAIL_HTML_PATTERN, [$this, 'encryptMail'], $string) ?: '';
        }

        return preg_replace_callback(self::MAIL_TEXT_PATTERN, [$this, 'encryptMailText'], $string) ?: '';
    }
public function antispam ( string $ string , bool $ html = true ) : string { if ( $ html ) { return preg_replace_callback ( self :: MAIL_HTML_PATTERN , [ $ this , 'encryptMail' ] , $ string ) ? : '' ; } return preg_replace_callback ( self :: MAIL_TEXT_PATTERN , [ $ this , 'encryptMailText' ] , $ string ) ? : '' ; }
Replaces E-Mail addresses with an alternative text representation.

@param string $string input string
@param bool   $html   Secure html or text

@return string with replaced links
Replaces E - Mail addresses with an alternative text representation .