Bundle/BusinessEntityBundle/Transliterator/Transliterator.php
private static function postProcessText($text, $separator, $excludeTwig)
    {
        if (function_exists('mb_strtolower')) {
            $text = mb_strtolower($text);
        } else {
            $text = strtolower($text);
        }
        if (!$excludeTwig) {
            $text = preg_replace('/\W/', ' ', $text);
        }
        $text = preg_replace('/::/', '/', $text);
        $text = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\1_\2', $text);
        $text = preg_replace('/([a-z\d])([A-Z])/', '\1_\2', $text);

        if ($excludeTwig) {
            // this regex match all word, characters, number, twig variables.
            $text = preg_replace('/(?:\\{\\{\\s*%\\s*[^}]+\\}\\})|(\\{\\{\\s*(?!%)\\s*(?>(?!\\.)[^\\s{}%]*)(?<!%)\\s*\\}\\}|\\w+)|(?:.)/mx', '$1 ', $text);
            $text = preg_replace('!\s+!', $separator, $text);
        } else {
            $text = preg_replace('/[^A-Za-z0-9\/]+/', $separator, $text);
        }
        $text = strtolower($text);
        $text = trim($text, '-');

        return $text;
    }
private static function postProcessText($text, $separator, $excludeTwig)
    {
        if (function_exists('mb_strtolower')) {
            $text = mb_strtolower($text);
        } else {
            $text = strtolower($text);
        }
        if (!$excludeTwig) {
            $text = preg_replace('/\W/', ' ', $text);
        }
        $text = preg_replace('/::/', '/', $text);
        $text = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\1_\2', $text);
        $text = preg_replace('/([a-z\d])([A-Z])/', '\1_\2', $text);

        if ($excludeTwig) {
            // this regex match all word, characters, number, twig variables.
            $text = preg_replace('/(?:\\{\\{\\s*%\\s*[^}]+\\}\\})|(\\{\\{\\s*(?!%)\\s*(?>(?!\\.)[^\\s{}%]*)(?<!%)\\s*\\}\\}|\\w+)|(?:.)/mx', '$1 ', $text);
            $text = preg_replace('!\s+!', $separator, $text);
        } else {
            $text = preg_replace('/[^A-Za-z0-9\/]+/', $separator, $text);
        }
        $text = strtolower($text);
        $text = trim($text, '-');

        return $text;
    }
private static function postProcessText ( $ text , $ separator , $ excludeTwig ) { if ( function_exists ( 'mb_strtolower' ) ) { $ text = mb_strtolower ( $ text ) ; } else { $ text = strtolower ( $ text ) ; } if ( ! $ excludeTwig ) { $ text = preg_replace ( '/\W/' , ' ' , $ text ) ; } $ text = preg_replace ( '/::/' , '/' , $ text ) ; $ text = preg_replace ( '/([A-Z]+)([A-Z][a-z])/' , '\1_\2' , $ text ) ; $ text = preg_replace ( '/([a-z\d])([A-Z])/' , '\1_\2' , $ text ) ; if ( $ excludeTwig ) { // this regex match all word, characters, number, twig variables. $ text = preg_replace ( '/(?:\\{\\{\\s*%\\s*[^}]+\\}\\})|(\\{\\{\\s*(?!%)\\s*(?>(?!\\.)[^\\s{}%]*)(?<!%)\\s*\\}\\}|\\w+)|(?:.)/mx' , '$1 ' , $ text ) ; $ text = preg_replace ( '!\s+!' , $ separator , $ text ) ; } else { $ text = preg_replace ( '/[^A-Za-z0-9\/]+/' , $ separator , $ text ) ; } $ text = strtolower ( $ text ) ; $ text = trim ( $ text , '-' ) ; return $ text ; }
Cleans up the text and adds separator and keep twig variable.

@param string $text
@param string $separator
@param bool   $excludeTwig

@return string
Cleans up the text and adds separator and keep twig variable .