concrete/src/Database/Query/LikeBuilder.php
public function escapeForLike($string, $wildcardAtStart = true, $wildcardAtEnd = true)
    {
        if ($wildcardAtStart) {
            $result = $this->anyCharacterWildcard;
        } else {
            $result = '';
        }
        $result .= strtr((string) $string, $this->getEscapeMap());
        if ($wildcardAtEnd && $result !== $this->anyCharacterWildcard) {
            $result .= $this->anyCharacterWildcard;
        }

        return $result;
    }
public function escapeForLike($string, $wildcardAtStart = true, $wildcardAtEnd = true)
    {
        if ($wildcardAtStart) {
            $result = $this->anyCharacterWildcard;
        } else {
            $result = '';
        }
        $result .= strtr((string) $string, $this->getEscapeMap());
        if ($wildcardAtEnd && $result !== $this->anyCharacterWildcard) {
            $result .= $this->anyCharacterWildcard;
        }

        return $result;
    }
public function escapeForLike ( $ string , $ wildcardAtStart = true , $ wildcardAtEnd = true ) { if ( $ wildcardAtStart ) { $ result = $ this -> anyCharacterWildcard ; } else { $ result = '' ; } $ result .= strtr ( ( string ) $ string , $ this -> getEscapeMap ( ) ) ; if ( $ wildcardAtEnd && $ result !== $ this -> anyCharacterWildcard ) { $ result .= $ this -> anyCharacterWildcard ; } return $ result ; }
Escape a string to be safely used as a parameter for a LIKE query.

@param string $string The string to be escaped
@param bool $wildcardAtStart whether to add the any-character wildcard as a prefix
@param bool $wildcardAtEnd whether to add the any-character wildcard as a suffix

@return string

@example escapeForLike('Hi% there', false, true) will return 'Hi\% there%'
Escape a string to be safely used as a parameter for a LIKE query .