Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like SphinxQL often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use SphinxQL, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 13 | class SphinxQL |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * A non-static connection for the current SphinxQL object |
||
| 17 | * |
||
| 18 | * @var ConnectionInterface |
||
| 19 | */ |
||
| 20 | protected $connection = null; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * The last result object. |
||
| 24 | * |
||
| 25 | * @var array |
||
| 26 | */ |
||
| 27 | protected $last_result = null; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * The last compiled query. |
||
| 31 | * |
||
| 32 | * @var string |
||
| 33 | */ |
||
| 34 | protected $last_compiled = null; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * The last chosen method (select, insert, replace, update, delete). |
||
| 38 | * |
||
| 39 | * @var string |
||
| 40 | */ |
||
| 41 | protected $type = null; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * An SQL query that is not yet executed or "compiled" |
||
| 45 | * |
||
| 46 | * @var string |
||
| 47 | */ |
||
| 48 | protected $query = null; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Array of select elements that will be comma separated. |
||
| 52 | * |
||
| 53 | * @var array |
||
| 54 | */ |
||
| 55 | protected $select = array(); |
||
| 56 | |||
| 57 | /** |
||
| 58 | * From in SphinxQL is the list of indexes that will be used |
||
| 59 | * |
||
| 60 | * @var array |
||
| 61 | */ |
||
| 62 | protected $from = array(); |
||
| 63 | |||
| 64 | /** |
||
| 65 | * The list of where and parenthesis, must be inserted in order |
||
| 66 | * |
||
| 67 | * @var array |
||
| 68 | */ |
||
| 69 | protected $where = array(); |
||
| 70 | |||
| 71 | /** |
||
| 72 | * The list of matches for the MATCH function in SphinxQL |
||
| 73 | * |
||
| 74 | * @var array |
||
| 75 | */ |
||
| 76 | protected $match = array(); |
||
| 77 | |||
| 78 | /** |
||
| 79 | * GROUP BY array to be comma separated |
||
| 80 | * |
||
| 81 | * @var array |
||
| 82 | */ |
||
| 83 | protected $group_by = array(); |
||
| 84 | |||
| 85 | /** |
||
| 86 | * ORDER BY array |
||
| 87 | * |
||
| 88 | * @var array |
||
| 89 | */ |
||
| 90 | protected $within_group_order_by = array(); |
||
| 91 | |||
| 92 | /** |
||
| 93 | * The list of where and parenthesis, must be inserted in order |
||
| 94 | * |
||
| 95 | * @var array |
||
| 96 | */ |
||
| 97 | protected $having = array(); |
||
| 98 | |||
| 99 | /** |
||
| 100 | * ORDER BY array |
||
| 101 | * |
||
| 102 | * @var array |
||
| 103 | */ |
||
| 104 | protected $order_by = array(); |
||
| 105 | |||
| 106 | /** |
||
| 107 | * When not null it adds an offset |
||
| 108 | * |
||
| 109 | * @var null|int |
||
| 110 | */ |
||
| 111 | protected $offset = null; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * When not null it adds a limit |
||
| 115 | * |
||
| 116 | * @var null|int |
||
| 117 | */ |
||
| 118 | protected $limit = null; |
||
| 119 | |||
| 120 | /** |
||
| 121 | * Value of INTO query for INSERT or REPLACE |
||
| 122 | * |
||
| 123 | * @var null|string |
||
| 124 | */ |
||
| 125 | protected $into = null; |
||
| 126 | |||
| 127 | /** |
||
| 128 | * Array of columns for INSERT or REPLACE |
||
| 129 | * |
||
| 130 | * @var array |
||
| 131 | */ |
||
| 132 | protected $columns = array(); |
||
| 133 | |||
| 134 | /** |
||
| 135 | * Array OF ARRAYS of values for INSERT or REPLACE |
||
| 136 | * |
||
| 137 | * @var array |
||
| 138 | */ |
||
| 139 | protected $values = array(); |
||
| 140 | |||
| 141 | /** |
||
| 142 | * Array arrays containing column and value for SET in UPDATE |
||
| 143 | * |
||
| 144 | * @var array |
||
| 145 | */ |
||
| 146 | protected $set = array(); |
||
| 147 | |||
| 148 | /** |
||
| 149 | * Array of OPTION specific to SphinxQL |
||
| 150 | * |
||
| 151 | * @var array |
||
| 152 | */ |
||
| 153 | protected $options = array(); |
||
| 154 | |||
| 155 | /** |
||
| 156 | * Array of FACETs |
||
| 157 | * |
||
| 158 | * @var Facet[] |
||
| 159 | */ |
||
| 160 | protected $facets = array(); |
||
| 161 | |||
| 162 | /** |
||
| 163 | * The reference to the object that queued itself and created this object |
||
| 164 | * |
||
| 165 | * @var null|SphinxQL |
||
| 166 | */ |
||
| 167 | protected $queue_prev = null; |
||
| 168 | |||
| 169 | /** |
||
| 170 | * An array of escaped characters for escapeMatch() |
||
| 171 | * @var array |
||
| 172 | */ |
||
| 173 | protected $escape_full_chars = array( |
||
| 174 | '\\' => '\\\\', |
||
| 175 | '(' => '\(', |
||
| 176 | ')' => '\)', |
||
| 177 | '|' => '\|', |
||
| 178 | '-' => '\-', |
||
| 179 | '!' => '\!', |
||
| 180 | '@' => '\@', |
||
| 181 | '~' => '\~', |
||
| 182 | '"' => '\"', |
||
| 183 | '&' => '\&', |
||
| 184 | '/' => '\/', |
||
| 185 | '^' => '\^', |
||
| 186 | '$' => '\$', |
||
| 187 | '=' => '\=', |
||
| 188 | '<' => '\<', |
||
| 189 | ); |
||
| 190 | |||
| 191 | /** |
||
| 192 | * An array of escaped characters for fullEscapeMatch() |
||
| 193 | * @var array |
||
| 194 | */ |
||
| 195 | protected $escape_half_chars = array( |
||
| 196 | '\\' => '\\\\', |
||
| 197 | '(' => '\(', |
||
| 198 | ')' => '\)', |
||
| 199 | '!' => '\!', |
||
| 200 | '@' => '\@', |
||
| 201 | '~' => '\~', |
||
| 202 | '&' => '\&', |
||
| 203 | '/' => '\/', |
||
| 204 | '^' => '\^', |
||
| 205 | '$' => '\$', |
||
| 206 | '=' => '\=', |
||
| 207 | '<' => '\<', |
||
| 208 | ); |
||
| 209 | |||
| 210 | public function __construct(ConnectionInterface $connection = null, $static = false) |
||
| 214 | |||
| 215 | /** |
||
| 216 | * Creates and setups a SphinxQL object |
||
| 217 | * |
||
| 218 | * @param ConnectionInterface $connection |
||
| 219 | * |
||
| 220 | * @return SphinxQL |
||
| 221 | */ |
||
| 222 | public static function create(ConnectionInterface $connection) |
||
| 226 | |||
| 227 | /** |
||
| 228 | * Returns the currently attached connection |
||
| 229 | * |
||
| 230 | * @returns ConnectionInterface |
||
| 231 | */ |
||
| 232 | public function getConnection() |
||
| 236 | |||
| 237 | /** |
||
| 238 | * Avoids having the expressions escaped |
||
| 239 | * |
||
| 240 | * Examples: |
||
| 241 | * $query->where('time', '>', SphinxQL::expr('CURRENT_TIMESTAMP')); |
||
| 242 | * // WHERE time > CURRENT_TIMESTAMP |
||
| 243 | * |
||
| 244 | * @param string $string The string to keep unaltered |
||
| 245 | * |
||
| 246 | * @return Expression The new Expression |
||
| 247 | */ |
||
| 248 | public static function expr($string = '') |
||
| 252 | |||
| 253 | /** |
||
| 254 | * Runs the query built |
||
| 255 | * |
||
| 256 | * @return ResultSetInterface The result of the query |
||
| 257 | */ |
||
| 258 | public function execute() |
||
| 263 | |||
| 264 | /** |
||
| 265 | * Executes a batch of queued queries |
||
| 266 | * |
||
| 267 | * @return MultiResultSetInterface The array of results |
||
| 268 | * @throws SphinxQLException In case no query is in queue |
||
| 269 | */ |
||
| 270 | public function executeBatch() |
||
| 284 | |||
| 285 | /** |
||
| 286 | * Enqueues the current object and returns a new one or the supplied one |
||
| 287 | * |
||
| 288 | * @param SphinxQL|null $next |
||
| 289 | * |
||
| 290 | * @return SphinxQL A new SphinxQL object with the current object referenced |
||
| 291 | */ |
||
| 292 | public function enqueue(SphinxQL $next = null) |
||
| 302 | |||
| 303 | /** |
||
| 304 | * Returns the ordered array of enqueued objects |
||
| 305 | * |
||
| 306 | * @return SphinxQL[] The ordered array of enqueued objects |
||
| 307 | */ |
||
| 308 | public function getQueue() |
||
| 321 | |||
| 322 | /** |
||
| 323 | * Gets the enqueued object |
||
| 324 | * |
||
| 325 | * @return SphinxQL|null |
||
| 326 | */ |
||
| 327 | public function getQueuePrev() |
||
| 331 | |||
| 332 | /** |
||
| 333 | * Sets the reference to the enqueued object |
||
| 334 | * |
||
| 335 | * @param SphinxQL $query The object to set as previous |
||
| 336 | * |
||
| 337 | * @return SphinxQL |
||
| 338 | */ |
||
| 339 | public function setQueuePrev($query) |
||
| 345 | |||
| 346 | /** |
||
| 347 | * Returns the result of the last query |
||
| 348 | * |
||
| 349 | * @return array The result of the last query |
||
| 350 | */ |
||
| 351 | public function getResult() |
||
| 355 | |||
| 356 | /** |
||
| 357 | * Returns the latest compiled query |
||
| 358 | * |
||
| 359 | * @return string The last compiled query |
||
| 360 | */ |
||
| 361 | public function getCompiled() |
||
| 365 | |||
| 366 | /** |
||
| 367 | * Begins transaction |
||
| 368 | */ |
||
| 369 | public function transactionBegin() |
||
| 373 | |||
| 374 | /** |
||
| 375 | * Commits transaction |
||
| 376 | */ |
||
| 377 | public function transactionCommit() |
||
| 381 | |||
| 382 | /** |
||
| 383 | * Rollbacks transaction |
||
| 384 | */ |
||
| 385 | public function transactionRollback() |
||
| 389 | |||
| 390 | /** |
||
| 391 | * Runs the compile function |
||
| 392 | * |
||
| 393 | * @return SphinxQL |
||
| 394 | */ |
||
| 395 | public function compile() |
||
| 418 | |||
| 419 | public function compileQuery() |
||
| 425 | |||
| 426 | /** |
||
| 427 | * Compiles the MATCH part of the queries |
||
| 428 | * Used by: SELECT, DELETE, UPDATE |
||
| 429 | * |
||
| 430 | * @return string The compiled MATCH |
||
| 431 | */ |
||
| 432 | public function compileMatch() |
||
| 473 | |||
| 474 | /** |
||
| 475 | * Compiles the WHERE part of the queries |
||
| 476 | * It interacts with the MATCH() and of course isn't usable stand-alone |
||
| 477 | * Used by: SELECT, DELETE, UPDATE |
||
| 478 | * |
||
| 479 | * @return string The compiled WHERE |
||
| 480 | */ |
||
| 481 | public function compileWhere() |
||
| 500 | |||
| 501 | public function compileFilterCondition($filter) |
||
| 529 | |||
| 530 | /** |
||
| 531 | * Compiles the statements for SELECT |
||
| 532 | * |
||
| 533 | * @return SphinxQL |
||
| 534 | */ |
||
| 535 | public function compileSelect() |
||
| 666 | |||
| 667 | /** |
||
| 668 | * Compiles the statements for INSERT or REPLACE |
||
| 669 | * |
||
| 670 | * @return SphinxQL |
||
| 671 | */ |
||
| 672 | public function compileInsert() |
||
| 704 | |||
| 705 | /** |
||
| 706 | * Compiles the statements for UPDATE |
||
| 707 | * |
||
| 708 | * @return SphinxQL |
||
| 709 | */ |
||
| 710 | public function compileUpdate() |
||
| 744 | |||
| 745 | /** |
||
| 746 | * Compiles the statements for DELETE |
||
| 747 | * |
||
| 748 | * @return SphinxQL |
||
| 749 | */ |
||
| 750 | public function compileDelete() |
||
| 767 | |||
| 768 | /** |
||
| 769 | * Sets a query to be executed |
||
| 770 | * |
||
| 771 | * @param string $sql A SphinxQL query to execute |
||
| 772 | * |
||
| 773 | * @return SphinxQL |
||
| 774 | */ |
||
| 775 | public function query($sql) |
||
| 782 | |||
| 783 | /** |
||
| 784 | * Select the columns |
||
| 785 | * |
||
| 786 | * Gets the arguments passed as $sphinxql->select('one', 'two') |
||
| 787 | * Using it without arguments equals to having '*' as argument |
||
| 788 | * Using it with array maps values as column names |
||
| 789 | * |
||
| 790 | * Examples: |
||
| 791 | * $query->select('title'); |
||
| 792 | * // SELECT title |
||
| 793 | * |
||
| 794 | * $query->select('title', 'author', 'date'); |
||
| 795 | * // SELECT title, author, date |
||
| 796 | * |
||
| 797 | * $query->select(['id', 'title']); |
||
| 798 | * // SELECT id, title |
||
| 799 | * |
||
| 800 | * @param array|string $columns Array or multiple string arguments containing column names |
||
| 801 | * |
||
| 802 | * @return SphinxQL |
||
| 803 | */ |
||
| 804 | public function select($columns = null) |
||
| 817 | |||
| 818 | /** |
||
| 819 | * Alters which arguments to select |
||
| 820 | * |
||
| 821 | * Query is assumed to be in SELECT mode |
||
| 822 | * See select() for usage |
||
| 823 | * |
||
| 824 | * @param array|string $columns Array or multiple string arguments containing column names |
||
| 825 | * |
||
| 826 | * @return SphinxQL |
||
| 827 | */ |
||
| 828 | View Code Duplication | public function setSelect($columns = null) |
|
| 838 | |||
| 839 | /** |
||
| 840 | * Get the columns staged to select |
||
| 841 | * |
||
| 842 | * @return array |
||
| 843 | */ |
||
| 844 | public function getSelect() |
||
| 848 | |||
| 849 | /** |
||
| 850 | * Activates the INSERT mode |
||
| 851 | * |
||
| 852 | * @return SphinxQL |
||
| 853 | */ |
||
| 854 | public function insert() |
||
| 861 | |||
| 862 | /** |
||
| 863 | * Activates the REPLACE mode |
||
| 864 | * |
||
| 865 | * @return SphinxQL |
||
| 866 | */ |
||
| 867 | public function replace() |
||
| 874 | |||
| 875 | /** |
||
| 876 | * Activates the UPDATE mode |
||
| 877 | * |
||
| 878 | * @param string $index The index to update into |
||
| 879 | * |
||
| 880 | * @return SphinxQL |
||
| 881 | */ |
||
| 882 | public function update($index) |
||
| 890 | |||
| 891 | /** |
||
| 892 | * Activates the DELETE mode |
||
| 893 | * |
||
| 894 | * @return SphinxQL |
||
| 895 | */ |
||
| 896 | public function delete() |
||
| 903 | |||
| 904 | /** |
||
| 905 | * FROM clause (Sphinx-specific since it works with multiple indexes) |
||
| 906 | * func_get_args()-enabled |
||
| 907 | * |
||
| 908 | * @param array $array An array of indexes to use |
||
| 909 | * |
||
| 910 | * @return SphinxQL |
||
| 911 | */ |
||
| 912 | public function from($array = null) |
||
| 924 | |||
| 925 | /** |
||
| 926 | * MATCH clause (Sphinx-specific) |
||
| 927 | * |
||
| 928 | * @param mixed $column The column name (can be array, string, Closure, or Match) |
||
| 929 | * @param string $value The value |
||
| 930 | * @param boolean $half Exclude ", |, - control characters from being escaped |
||
| 931 | * |
||
| 932 | * @return SphinxQL |
||
| 933 | */ |
||
| 934 | public function match($column, $value = null, $half = false) |
||
| 944 | |||
| 945 | /** |
||
| 946 | * WHERE clause |
||
| 947 | * |
||
| 948 | * Examples: |
||
| 949 | * $query->where('column', 'value'); |
||
| 950 | * // WHERE column = 'value' |
||
| 951 | * |
||
| 952 | * $query->where('column', '=', 'value'); |
||
| 953 | * // WHERE column = 'value' |
||
| 954 | * |
||
| 955 | * $query->where('column', '>=', 'value') |
||
| 956 | * // WHERE column >= 'value' |
||
| 957 | * |
||
| 958 | * $query->where('column', 'IN', array('value1', 'value2', 'value3')); |
||
| 959 | * // WHERE column IN ('value1', 'value2', 'value3') |
||
| 960 | * |
||
| 961 | * $query->where('column', 'BETWEEN', array('value1', 'value2')) |
||
| 962 | * // WHERE column BETWEEN 'value1' AND 'value2' |
||
| 963 | * // WHERE example BETWEEN 10 AND 100 |
||
| 964 | * |
||
| 965 | * @param string $column The column name |
||
| 966 | * @param string $operator The operator to use |
||
| 967 | * @param string $value The value to check against |
||
| 968 | * |
||
| 969 | * @return SphinxQL |
||
| 970 | */ |
||
| 971 | public function where($column, $operator, $value = null) |
||
| 986 | |||
| 987 | /** |
||
| 988 | * GROUP BY clause |
||
| 989 | * Adds to the previously added columns |
||
| 990 | * |
||
| 991 | * @param string $column A column to group by |
||
| 992 | * |
||
| 993 | * @return SphinxQL |
||
| 994 | */ |
||
| 995 | public function groupBy($column) |
||
| 1001 | |||
| 1002 | /** |
||
| 1003 | * WITHIN GROUP ORDER BY clause (SphinxQL-specific) |
||
| 1004 | * Adds to the previously added columns |
||
| 1005 | * Works just like a classic ORDER BY |
||
| 1006 | * |
||
| 1007 | * @param string $column The column to group by |
||
| 1008 | * @param string $direction The group by direction (asc/desc) |
||
| 1009 | * |
||
| 1010 | * @return SphinxQL |
||
| 1011 | */ |
||
| 1012 | public function withinGroupOrderBy($column, $direction = null) |
||
| 1018 | |||
| 1019 | /** |
||
| 1020 | * HAVING clause |
||
| 1021 | * |
||
| 1022 | * Examples: |
||
| 1023 | * $sq->having('column', 'value'); |
||
| 1024 | * // HAVING column = 'value' |
||
| 1025 | * |
||
| 1026 | * $sq->having('column', '=', 'value'); |
||
| 1027 | * // HAVING column = 'value' |
||
| 1028 | * |
||
| 1029 | * $sq->having('column', '>=', 'value') |
||
| 1030 | * // HAVING column >= 'value' |
||
| 1031 | * |
||
| 1032 | * $sq->having('column', 'IN', array('value1', 'value2', 'value3')); |
||
| 1033 | * // HAVING column IN ('value1', 'value2', 'value3') |
||
| 1034 | * |
||
| 1035 | * $sq->having('column', 'BETWEEN', array('value1', 'value2')) |
||
| 1036 | * // HAVING column BETWEEN 'value1' AND 'value2' |
||
| 1037 | * // HAVING example BETWEEN 10 AND 100 |
||
| 1038 | * |
||
| 1039 | * @param string $column The column name |
||
| 1040 | * @param string $operator The operator to use |
||
| 1041 | * @param string $value The value to check against |
||
| 1042 | * |
||
| 1043 | * @return SphinxQL The current object |
||
| 1044 | */ |
||
| 1045 | public function having($column, $operator, $value = null) |
||
| 1060 | |||
| 1061 | /** |
||
| 1062 | * ORDER BY clause |
||
| 1063 | * Adds to the previously added columns |
||
| 1064 | * |
||
| 1065 | * @param string $column The column to order on |
||
| 1066 | * @param string $direction The ordering direction (asc/desc) |
||
| 1067 | * |
||
| 1068 | * @return SphinxQL |
||
| 1069 | */ |
||
| 1070 | public function orderBy($column, $direction = null) |
||
| 1076 | |||
| 1077 | /** |
||
| 1078 | * LIMIT clause |
||
| 1079 | * Supports also LIMIT offset, limit |
||
| 1080 | * |
||
| 1081 | * @param int $offset Offset if $limit is specified, else limit |
||
| 1082 | * @param null|int $limit The limit to set, null for no limit |
||
| 1083 | * |
||
| 1084 | * @return SphinxQL |
||
| 1085 | */ |
||
| 1086 | public function limit($offset, $limit = null) |
||
| 1098 | |||
| 1099 | /** |
||
| 1100 | * OFFSET clause |
||
| 1101 | * |
||
| 1102 | * @param int $offset The offset |
||
| 1103 | * |
||
| 1104 | * @return SphinxQL |
||
| 1105 | */ |
||
| 1106 | public function offset($offset) |
||
| 1112 | |||
| 1113 | /** |
||
| 1114 | * OPTION clause (SphinxQL-specific) |
||
| 1115 | * Used by: SELECT |
||
| 1116 | * |
||
| 1117 | * @param string $name Option name |
||
| 1118 | * @param string $value Option value |
||
| 1119 | * |
||
| 1120 | * @return SphinxQL |
||
| 1121 | */ |
||
| 1122 | public function option($name, $value) |
||
| 1128 | |||
| 1129 | /** |
||
| 1130 | * INTO clause |
||
| 1131 | * Used by: INSERT, REPLACE |
||
| 1132 | * |
||
| 1133 | * @param string $index The index to insert/replace into |
||
| 1134 | * |
||
| 1135 | * @return SphinxQL |
||
| 1136 | */ |
||
| 1137 | public function into($index) |
||
| 1143 | |||
| 1144 | /** |
||
| 1145 | * Set columns |
||
| 1146 | * Used in: INSERT, REPLACE |
||
| 1147 | * func_get_args()-enabled |
||
| 1148 | * |
||
| 1149 | * @param array $array The array of columns |
||
| 1150 | * |
||
| 1151 | * @return SphinxQL |
||
| 1152 | */ |
||
| 1153 | View Code Duplication | public function columns($array = array()) |
|
| 1163 | |||
| 1164 | /** |
||
| 1165 | * Set VALUES |
||
| 1166 | * Used in: INSERT, REPLACE |
||
| 1167 | * func_get_args()-enabled |
||
| 1168 | * |
||
| 1169 | * @param array $array The array of values matching the columns from $this->columns() |
||
| 1170 | * |
||
| 1171 | * @return SphinxQL |
||
| 1172 | */ |
||
| 1173 | public function values($array) |
||
| 1183 | |||
| 1184 | /** |
||
| 1185 | * Set column and relative value |
||
| 1186 | * Used in: INSERT, REPLACE |
||
| 1187 | * |
||
| 1188 | * @param string $column The column name |
||
| 1189 | * @param string $value The value |
||
| 1190 | * |
||
| 1191 | * @return SphinxQL |
||
| 1192 | */ |
||
| 1193 | public function value($column, $value) |
||
| 1204 | |||
| 1205 | /** |
||
| 1206 | * Allows passing an array with the key as column and value as value |
||
| 1207 | * Used in: INSERT, REPLACE, UPDATE |
||
| 1208 | * |
||
| 1209 | * @param array $array Array of key-values |
||
| 1210 | * |
||
| 1211 | * @return SphinxQL |
||
| 1212 | */ |
||
| 1213 | public function set($array) |
||
| 1225 | |||
| 1226 | /** |
||
| 1227 | * Allows passing an array with the key as column and value as value |
||
| 1228 | * Used in: INSERT, REPLACE, UPDATE |
||
| 1229 | * |
||
| 1230 | * @param Facet $facet |
||
| 1231 | * @return SphinxQL |
||
| 1232 | */ |
||
| 1233 | public function facet($facet) |
||
| 1239 | |||
| 1240 | /** |
||
| 1241 | * Sets the characters used for escapeMatch(). |
||
| 1242 | * |
||
| 1243 | * @param array $array The array of characters to escape |
||
| 1244 | * |
||
| 1245 | * @return SphinxQL The escaped characters |
||
| 1246 | */ |
||
| 1247 | public function setFullEscapeChars($array = array()) |
||
| 1255 | |||
| 1256 | /** |
||
| 1257 | * Sets the characters used for halfEscapeMatch(). |
||
| 1258 | * |
||
| 1259 | * @param array $array The array of characters to escape |
||
| 1260 | * |
||
| 1261 | * @return SphinxQL The escaped characters |
||
| 1262 | */ |
||
| 1263 | public function setHalfEscapeChars($array = array()) |
||
| 1271 | |||
| 1272 | /** |
||
| 1273 | * Compiles an array containing the characters and escaped characters into a key/value configuration. |
||
| 1274 | * |
||
| 1275 | * @param array $array The array of characters to escape |
||
| 1276 | * |
||
| 1277 | * @return array An array of the characters and it's escaped counterpart |
||
| 1278 | */ |
||
| 1279 | public function compileEscapeChars($array = array()) |
||
| 1288 | |||
| 1289 | /** |
||
| 1290 | * Escapes the query for the MATCH() function |
||
| 1291 | * |
||
| 1292 | * @param string $string The string to escape for the MATCH |
||
| 1293 | * |
||
| 1294 | * @return string The escaped string |
||
| 1295 | */ |
||
| 1296 | public function escapeMatch($string) |
||
| 1304 | |||
| 1305 | /** |
||
| 1306 | * Escapes the query for the MATCH() function |
||
| 1307 | * Allows some of the control characters to pass through for use with a search field: -, |, " |
||
| 1308 | * It also does some tricks to wrap/unwrap within " the string and prevents errors |
||
| 1309 | * |
||
| 1310 | * @param string $string The string to escape for the MATCH |
||
| 1311 | * |
||
| 1312 | * @return string The escaped string |
||
| 1313 | */ |
||
| 1314 | public function halfEscapeMatch($string) |
||
| 1340 | |||
| 1341 | /** |
||
| 1342 | * Clears the existing query build for new query when using the same SphinxQL instance. |
||
| 1343 | * |
||
| 1344 | * @return SphinxQL |
||
| 1345 | */ |
||
| 1346 | public function reset() |
||
| 1367 | |||
| 1368 | public function resetWhere() |
||
| 1374 | |||
| 1375 | public function resetMatch() |
||
| 1381 | |||
| 1382 | public function resetGroupBy() |
||
| 1388 | |||
| 1389 | public function resetWithinGroupOrderBy() |
||
| 1395 | |||
| 1396 | public function resetHaving() |
||
| 1402 | |||
| 1403 | public function resetOrderBy() |
||
| 1409 | |||
| 1410 | public function resetOptions() |
||
| 1416 | } |
||
| 1417 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.