public function formatWildcards($value)
    {
        $from = $to = $substFrom = $substTo = [];
        if ($this->getConfig('wildcardAny') !== '%') {
            $from[] = $this->getConfig('fromWildCardAny');
            $to[] = $this->getConfig('toWildCardAny');
            $substFrom[] = $this->getConfig('wildcardAny');
            $substTo[] = '%';
        }
        if ($this->getConfig('wildcardOne') !== '_') {
            $from[] = $this->getConfig('fromWildCardOne');
            $to[] = $this->getConfig('toWildCardOne');
            $substFrom[] = $this->getConfig('wildcardOne');
            $substTo[] = '_';
        }
        if ($from) {
            // Escape first
            $value = str_replace($from, $to, $value);
            // Replace wildcards
            $value = str_replace($substFrom, $substTo, $value);
        }

        return $value;
    }
public function formatWildcards($value)
    {
        $from = $to = $substFrom = $substTo = [];
        if ($this->getConfig('wildcardAny') !== '%') {
            $from[] = $this->getConfig('fromWildCardAny');
            $to[] = $this->getConfig('toWildCardAny');
            $substFrom[] = $this->getConfig('wildcardAny');
            $substTo[] = '%';
        }
        if ($this->getConfig('wildcardOne') !== '_') {
            $from[] = $this->getConfig('fromWildCardOne');
            $to[] = $this->getConfig('toWildCardOne');
            $substFrom[] = $this->getConfig('wildcardOne');
            $substTo[] = '_';
        }
        if ($from) {
            // Escape first
            $value = str_replace($from, $to, $value);
            // Replace wildcards
            $value = str_replace($substFrom, $substTo, $value);
        }

        return $value;
    }
public function formatWildcards ( $ value ) { $ from = $ to = $ substFrom = $ substTo = [ ] ; if ( $ this -> getConfig ( 'wildcardAny' ) !== '%' ) { $ from [ ] = $ this -> getConfig ( 'fromWildCardAny' ) ; $ to [ ] = $ this -> getConfig ( 'toWildCardAny' ) ; $ substFrom [ ] = $ this -> getConfig ( 'wildcardAny' ) ; $ substTo [ ] = '%' ; } if ( $ this -> getConfig ( 'wildcardOne' ) !== '_' ) { $ from [ ] = $ this -> getConfig ( 'fromWildCardOne' ) ; $ to [ ] = $ this -> getConfig ( 'toWildCardOne' ) ; $ substFrom [ ] = $ this -> getConfig ( 'wildcardOne' ) ; $ substTo [ ] = '_' ; } if ( $ from ) { // Escape first $ value = str_replace ( $ from , $ to , $ value ) ; // Replace wildcards $ value = str_replace ( $ substFrom , $ substTo , $ value ) ; } return $ value ; }
Replace substitutions with original wildcards
but first, escape the original wildcards in the text to use them as normal search text

@param string $value Value.
@return string Value
Replace substitutions with original wildcards but first escape the original wildcards in the text to use them as normal search text