src/Ten24/Twig/Extension/EmailEncodingExtension.php
protected function encodeText($text)
    {
        $encoded_text = '';

        for ($i = 0; $i < strlen($text); $i++) {
            $char = $text{$i};
            $r    = rand(0, 100);

            # roughly 10% raw, 45% hex, 45% dec
            # '@' *must* be encoded. I insist.
            if ($r > 90 && $char != '@') {
                $encoded_text .= $char;
            } else if ($r < 45) {
                $encoded_text .= '&#x'.dechex(ord($char)).';';
            } else {
                $encoded_text .= '&#'.ord($char).';';
            }
        }

        return $encoded_text;
    }
protected function encodeText($text)
    {
        $encoded_text = '';

        for ($i = 0; $i < strlen($text); $i++) {
            $char = $text{$i};
            $r    = rand(0, 100);

            # roughly 10% raw, 45% hex, 45% dec
            # '@' *must* be encoded. I insist.
            if ($r > 90 && $char != '@') {
                $encoded_text .= $char;
            } else if ($r < 45) {
                $encoded_text .= '&#x'.dechex(ord($char)).';';
            } else {
                $encoded_text .= '&#'.ord($char).';';
            }
        }

        return $encoded_text;
    }
protected function encodeText ( $ text ) { $ encoded_text = '' ; for ( $ i = 0 ; $ i < strlen ( $ text ) ; $ i ++ ) { $ char = $ text { $ i } ; $ r = rand ( 0 , 100 ) ; # roughly 10% raw, 45% hex, 45% dec # '@' *must* be encoded. I insist. if ( $ r > 90 && $ char != '@' ) { $ encoded_text .= $ char ; } else if ( $ r < 45 ) { $ encoded_text .= '&#x' . dechex ( ord ( $ char ) ) . ';' ; } else { $ encoded_text .= '&#' . ord ( $ char ) . ';' ; } } return $ encoded_text ; }
Thanks to SF 1.2 UrlHelper.php

@param $text

@return string
Thanks to SF 1 . 2 UrlHelper . php