src/Translator.php
public static function sanitizePluralExpression($expr)
    {
        // Parse equation
        $expr = explode(';', $expr);
        if (count($expr) >= 2) {
            $expr = $expr[1];
        } else {
            $expr = $expr[0];
        }
        $expr = trim(strtolower($expr));
        // Strip plural prefix
        if (substr($expr, 0, 6) === 'plural') {
            $expr = ltrim(substr($expr, 6));
        }
        // Strip equals
        if (substr($expr, 0, 1) === '=') {
            $expr = ltrim(substr($expr, 1));
        }

        // Cleanup from unwanted chars
        $expr = preg_replace('@[^n0-9:\(\)\?=!<>/%&| ]@', '', $expr);

        return $expr;
    }
public static function sanitizePluralExpression($expr)
    {
        // Parse equation
        $expr = explode(';', $expr);
        if (count($expr) >= 2) {
            $expr = $expr[1];
        } else {
            $expr = $expr[0];
        }
        $expr = trim(strtolower($expr));
        // Strip plural prefix
        if (substr($expr, 0, 6) === 'plural') {
            $expr = ltrim(substr($expr, 6));
        }
        // Strip equals
        if (substr($expr, 0, 1) === '=') {
            $expr = ltrim(substr($expr, 1));
        }

        // Cleanup from unwanted chars
        $expr = preg_replace('@[^n0-9:\(\)\?=!<>/%&| ]@', '', $expr);

        return $expr;
    }
public static function sanitizePluralExpression ( $ expr ) { // Parse equation $ expr = explode ( ';' , $ expr ) ; if ( count ( $ expr ) >= 2 ) { $ expr = $ expr [ 1 ] ; } else { $ expr = $ expr [ 0 ] ; } $ expr = trim ( strtolower ( $ expr ) ) ; // Strip plural prefix if ( substr ( $ expr , 0 , 6 ) === 'plural' ) { $ expr = ltrim ( substr ( $ expr , 6 ) ) ; } // Strip equals if ( substr ( $ expr , 0 , 1 ) === '=' ) { $ expr = ltrim ( substr ( $ expr , 1 ) ) ; } // Cleanup from unwanted chars $ expr = preg_replace ( '@[^n0-9:\(\)\?=!<>/%&| ]@' , '' , $ expr ) ; return $ expr ; }
Sanitize plural form expression for use in ExpressionLanguage.

@param string $expr Expression to sanitize

@return string sanitized plural form expression
Sanitize plural form expression for use in ExpressionLanguage .