protected static function _replaceRuleText($text, $rule){
        for ($parts = 1; $parts < 20; $parts++){
            if (false === strpos($rule, "{T$parts}"))
                break;
        }
        if (1=== $parts){
            return str_replace(["T", "T1"], $text, $rule);
        }
        $text = str_replace("\\|", "<<__E\$C@P#D__>>", $text);
        $pieces = explode("|", $text, $parts);
        $text = str_replace("{T}", $text, $rule);
        for ($i = 0; $i < $parts; $i++){
            $text = str_replace("{T".($i+1)."}", $pieces[$i], $text);
        }
        return str_replace("<<__E\$C@P#D__>>", "\\|", $text);
    }
protected static function _replaceRuleText($text, $rule){
        for ($parts = 1; $parts < 20; $parts++){
            if (false === strpos($rule, "{T$parts}"))
                break;
        }
        if (1=== $parts){
            return str_replace(["T", "T1"], $text, $rule);
        }
        $text = str_replace("\\|", "<<__E\$C@P#D__>>", $text);
        $pieces = explode("|", $text, $parts);
        $text = str_replace("{T}", $text, $rule);
        for ($i = 0; $i < $parts; $i++){
            $text = str_replace("{T".($i+1)."}", $pieces[$i], $text);
        }
        return str_replace("<<__E\$C@P#D__>>", "\\|", $text);
    }
protected static function _replaceRuleText ( $ text , $ rule ) { for ( $ parts = 1 ; $ parts < 20 ; $ parts ++ ) { if ( false === strpos ( $ rule , "{T$parts}" ) ) break ; } if ( 1 === $ parts ) { return str_replace ( [ "T" , "T1" ] , $ text , $ rule ) ; } $ text = str_replace ( "\\|" , "<<__E\$C@P#D__>>" , $ text ) ; $ pieces = explode ( "|" , $ text , $ parts ) ; $ text = str_replace ( "{T}" , $ text , $ rule ) ; for ( $ i = 0 ; $ i < $ parts ; $ i ++ ) { $ text = str_replace ( "{T" . ( $ i + 1 ) . "}" , $ pieces [ $ i ] , $ text ) ; } return str_replace ( "<<__E\$C@P#D__>>" , "\\|" , $ text ) ; }
Replaced found text for a rule.
@param string $text
@param string $rule
@return string
Replaced found text for a rule .