<?php
-
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
* Class CRM_Utils_QueryFormatter
protected $mode;
/**
- * @param string $mode eg MODE_NONE
+ * @param string $mode
+ * Eg MODE_NONE.
*/
public function __construct($mode) {
$this->mode = $mode;
/**
* @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
*/
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;
}
return $text;
}
+ /**
+ * Format Fts.
+ *
+ * @param string $text
+ * @param $mode
+ *
+ * @return mixed
+ */
protected function _formatFts($text, $mode) {
$result = NULL;
return $this->dedupeWildcards($result, '%');
}
+ /**
+ * Format FTS.
+ *
+ * @param string $text
+ * @param $mode
+ *
+ * @return mixed
+ */
protected function _formatFtsBool($text, $mode) {
$result = NULL;
return $this->dedupeWildcards($result, '%');
}
+ /**
+ * Format like.
+ *
+ * @param $text
+ * @param $mode
+ *
+ * @return mixed
+ */
protected function _formatLike($text, $mode) {
$result = NULL;
}
/**
- * @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) {
return $text;
}
+ /**
+ * Get modes.
+ *
+ * @return array
+ */
public static function getModes() {
return array(
self::MODE_NONE,
);
}
+ /**
+ * Get languages.
+ *
+ * @return array
+ */
public static function getLanguages() {
return array(
self::LANG_SOLR,
echo $buf;
}
+
}