X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FQueryFormatter.php;h=14694b1cf2dfd7c3580b0efc5ccad75a7c836c85;hb=c5f5f99a9ec5c80e62dd245b345231c4f1a05a78;hp=4222339b65db34e4b0a4f2de02d0b816e6ec74bd;hpb=e01a5ffed559ccb3a64fba29f0ca8964e00d3178;p=civicrm-core.git diff --git a/CRM/Utils/QueryFormatter.php b/CRM/Utils/QueryFormatter.php index 4222339b65..14694b1cf2 100644 --- a/CRM/Utils/QueryFormatter.php +++ b/CRM/Utils/QueryFormatter.php @@ -1,8 +1,7 @@ mode = $mode; } @@ -111,7 +111,8 @@ class CRM_Utils_QueryFormatter { /** * @param string $text - * @param string $language eg LANG_SQL_LIKE, LANG_SQL_FTS, LANG_SOLR + * @param string $language + * Eg LANG_SQL_LIKE, LANG_SQL_FTS, LANG_SOLR. * @throws CRM_Core_Exception * @return string */ @@ -123,12 +124,15 @@ class CRM_Utils_QueryFormatter { case self::LANG_SQL_FTS: $text = $this->_formatFts($text, $this->mode); break; + case self::LANG_SQL_FTSBOOL: $text = $this->_formatFtsBool($text, $this->mode); break; + case self::LANG_SQL_LIKE: $text = $this->_formatLike($text, $this->mode); break; + default: $text = NULL; } @@ -140,6 +144,14 @@ class CRM_Utils_QueryFormatter { return $text; } + /** + * Format Fts. + * + * @param string $text + * @param $mode + * + * @return mixed + */ protected function _formatFts($text, $mode) { $result = NULL; @@ -183,6 +195,14 @@ class CRM_Utils_QueryFormatter { return $this->dedupeWildcards($result, '%'); } + /** + * Format FTS. + * + * @param string $text + * @param $mode + * + * @return mixed + */ protected function _formatFtsBool($text, $mode) { $result = NULL; @@ -234,6 +254,14 @@ class CRM_Utils_QueryFormatter { return $this->dedupeWildcards($result, '%'); } + /** + * Format like. + * + * @param $text + * @param $mode + * + * @return mixed + */ protected function _formatLike($text, $mode) { $result = NULL; @@ -266,8 +294,10 @@ class CRM_Utils_QueryFormatter { } /** - * @param string $text user-supplied query string - * @param string $template a prototypical description of each word, eg "word%" or "word*" or "*word*" + * @param string $text + * User-supplied query string. + * @param string $template + * A prototypical description of each word, eg "word%" or "word*" or "*word*". * @return string */ protected function mapWords($text, $template) { @@ -303,6 +333,11 @@ class CRM_Utils_QueryFormatter { return $text; } + /** + * Get modes. + * + * @return array + */ public static function getModes() { return array( self::MODE_NONE, @@ -313,6 +348,11 @@ class CRM_Utils_QueryFormatter { ); } + /** + * Get languages. + * + * @return array + */ public static function getLanguages() { return array( self::LANG_SOLR, @@ -348,4 +388,5 @@ class CRM_Utils_QueryFormatter { echo $buf; } -} \ No newline at end of file + +}