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 | * When not null changes 'GROUP BY' to 'GROUP N BY' |
||
87 | * |
||
88 | * @var null|int |
||
89 | */ |
||
90 | protected $group_n_by = null; |
||
91 | |||
92 | /** |
||
93 | * ORDER BY array |
||
94 | * |
||
95 | * @var array |
||
96 | */ |
||
97 | protected $within_group_order_by = array(); |
||
98 | |||
99 | /** |
||
100 | * The list of where and parenthesis, must be inserted in order |
||
101 | * |
||
102 | * @var array |
||
103 | */ |
||
104 | protected $having = array(); |
||
105 | |||
106 | /** |
||
107 | * ORDER BY array |
||
108 | * |
||
109 | * @var array |
||
110 | */ |
||
111 | protected $order_by = array(); |
||
112 | |||
113 | /** |
||
114 | * When not null it adds an offset |
||
115 | * |
||
116 | * @var null|int |
||
117 | */ |
||
118 | protected $offset = null; |
||
119 | |||
120 | /** |
||
121 | * When not null it adds a limit |
||
122 | * |
||
123 | * @var null|int |
||
124 | */ |
||
125 | protected $limit = null; |
||
126 | |||
127 | /** |
||
128 | * Value of INTO query for INSERT or REPLACE |
||
129 | * |
||
130 | * @var null|string |
||
131 | */ |
||
132 | protected $into = null; |
||
133 | |||
134 | /** |
||
135 | * Array of columns for INSERT or REPLACE |
||
136 | * |
||
137 | * @var array |
||
138 | */ |
||
139 | protected $columns = array(); |
||
140 | |||
141 | /** |
||
142 | * Array OF ARRAYS of values for INSERT or REPLACE |
||
143 | * |
||
144 | * @var array |
||
145 | */ |
||
146 | protected $values = array(); |
||
147 | |||
148 | /** |
||
149 | * Array arrays containing column and value for SET in UPDATE |
||
150 | * |
||
151 | * @var array |
||
152 | */ |
||
153 | protected $set = array(); |
||
154 | |||
155 | /** |
||
156 | * Array of OPTION specific to SphinxQL |
||
157 | * |
||
158 | * @var array |
||
159 | */ |
||
160 | protected $options = array(); |
||
161 | |||
162 | /** |
||
163 | * Array of FACETs |
||
164 | * |
||
165 | * @var Facet[] |
||
166 | */ |
||
167 | protected $facets = array(); |
||
168 | |||
169 | /** |
||
170 | * The reference to the object that queued itself and created this object |
||
171 | * |
||
172 | * @var null|SphinxQL |
||
173 | */ |
||
174 | protected $queue_prev = null; |
||
175 | |||
176 | /** |
||
177 | * An array of escaped characters for escapeMatch() |
||
178 | * @var array |
||
179 | */ |
||
180 | protected $escape_full_chars = array( |
||
181 | '\\' => '\\\\', |
||
182 | '(' => '\(', |
||
183 | ')' => '\)', |
||
184 | '|' => '\|', |
||
185 | '-' => '\-', |
||
186 | '!' => '\!', |
||
187 | '@' => '\@', |
||
188 | '~' => '\~', |
||
189 | '"' => '\"', |
||
190 | '&' => '\&', |
||
191 | '/' => '\/', |
||
192 | '^' => '\^', |
||
193 | '$' => '\$', |
||
194 | '=' => '\=', |
||
195 | '<' => '\<', |
||
196 | ); |
||
197 | |||
198 | /** |
||
199 | * An array of escaped characters for fullEscapeMatch() |
||
200 | * @var array |
||
201 | */ |
||
202 | protected $escape_half_chars = array( |
||
203 | '\\' => '\\\\', |
||
204 | '(' => '\(', |
||
205 | ')' => '\)', |
||
206 | '!' => '\!', |
||
207 | '@' => '\@', |
||
208 | '~' => '\~', |
||
209 | '&' => '\&', |
||
210 | '/' => '\/', |
||
211 | '^' => '\^', |
||
212 | '$' => '\$', |
||
213 | '=' => '\=', |
||
214 | '<' => '\<', |
||
215 | ); |
||
216 | |||
217 | public function __construct(ConnectionInterface $connection = null, $static = false) |
||
221 | |||
222 | /** |
||
223 | * Creates and setups a SphinxQL object |
||
224 | * |
||
225 | * @param ConnectionInterface $connection |
||
226 | * |
||
227 | * @return SphinxQL |
||
228 | */ |
||
229 | public static function create(ConnectionInterface $connection) |
||
233 | |||
234 | /** |
||
235 | * Returns the currently attached connection |
||
236 | * |
||
237 | * @returns ConnectionInterface |
||
238 | */ |
||
239 | public function getConnection() |
||
243 | |||
244 | /** |
||
245 | * Avoids having the expressions escaped |
||
246 | * |
||
247 | * Examples: |
||
248 | * $query->where('time', '>', SphinxQL::expr('CURRENT_TIMESTAMP')); |
||
249 | * // WHERE time > CURRENT_TIMESTAMP |
||
250 | * |
||
251 | * @param string $string The string to keep unaltered |
||
252 | * |
||
253 | * @return Expression The new Expression |
||
254 | */ |
||
255 | public static function expr($string = '') |
||
259 | |||
260 | /** |
||
261 | * Runs the query built |
||
262 | * |
||
263 | * @return ResultSetInterface The result of the query |
||
264 | */ |
||
265 | public function execute() |
||
270 | |||
271 | /** |
||
272 | * Executes a batch of queued queries |
||
273 | * |
||
274 | * @return MultiResultSetInterface The array of results |
||
275 | * @throws SphinxQLException In case no query is in queue |
||
276 | */ |
||
277 | public function executeBatch() |
||
291 | |||
292 | /** |
||
293 | * Enqueues the current object and returns a new one or the supplied one |
||
294 | * |
||
295 | * @param SphinxQL|null $next |
||
296 | * |
||
297 | * @return SphinxQL A new SphinxQL object with the current object referenced |
||
298 | */ |
||
299 | public function enqueue(SphinxQL $next = null) |
||
309 | |||
310 | /** |
||
311 | * Returns the ordered array of enqueued objects |
||
312 | * |
||
313 | * @return SphinxQL[] The ordered array of enqueued objects |
||
314 | */ |
||
315 | public function getQueue() |
||
328 | |||
329 | /** |
||
330 | * Gets the enqueued object |
||
331 | * |
||
332 | * @return SphinxQL|null |
||
333 | */ |
||
334 | public function getQueuePrev() |
||
338 | |||
339 | /** |
||
340 | * Sets the reference to the enqueued object |
||
341 | * |
||
342 | * @param SphinxQL $query The object to set as previous |
||
343 | * |
||
344 | * @return SphinxQL |
||
345 | */ |
||
346 | public function setQueuePrev($query) |
||
352 | |||
353 | /** |
||
354 | * Returns the result of the last query |
||
355 | * |
||
356 | * @return array The result of the last query |
||
357 | */ |
||
358 | public function getResult() |
||
362 | |||
363 | /** |
||
364 | * Returns the latest compiled query |
||
365 | * |
||
366 | * @return string The last compiled query |
||
367 | */ |
||
368 | public function getCompiled() |
||
372 | |||
373 | /** |
||
374 | * Begins transaction |
||
375 | */ |
||
376 | public function transactionBegin() |
||
380 | |||
381 | /** |
||
382 | * Commits transaction |
||
383 | */ |
||
384 | public function transactionCommit() |
||
388 | |||
389 | /** |
||
390 | * Rollbacks transaction |
||
391 | */ |
||
392 | public function transactionRollback() |
||
396 | |||
397 | /** |
||
398 | * Runs the compile function |
||
399 | * |
||
400 | * @return SphinxQL |
||
401 | */ |
||
402 | public function compile() |
||
425 | |||
426 | public function compileQuery() |
||
432 | |||
433 | /** |
||
434 | * Compiles the MATCH part of the queries |
||
435 | * Used by: SELECT, DELETE, UPDATE |
||
436 | * |
||
437 | * @return string The compiled MATCH |
||
438 | */ |
||
439 | public function compileMatch() |
||
480 | |||
481 | /** |
||
482 | * Compiles the WHERE part of the queries |
||
483 | * It interacts with the MATCH() and of course isn't usable stand-alone |
||
484 | * Used by: SELECT, DELETE, UPDATE |
||
485 | * |
||
486 | * @return string The compiled WHERE |
||
487 | */ |
||
488 | public function compileWhere() |
||
507 | |||
508 | public function compileFilterCondition($filter) |
||
536 | |||
537 | /** |
||
538 | * Compiles the statements for SELECT |
||
539 | * |
||
540 | * @return SphinxQL |
||
541 | */ |
||
542 | public function compileSelect() |
||
677 | |||
678 | /** |
||
679 | * Compiles the statements for INSERT or REPLACE |
||
680 | * |
||
681 | * @return SphinxQL |
||
682 | */ |
||
683 | public function compileInsert() |
||
715 | |||
716 | /** |
||
717 | * Compiles the statements for UPDATE |
||
718 | * |
||
719 | * @return SphinxQL |
||
720 | */ |
||
721 | public function compileUpdate() |
||
755 | |||
756 | /** |
||
757 | * Compiles the statements for DELETE |
||
758 | * |
||
759 | * @return SphinxQL |
||
760 | */ |
||
761 | public function compileDelete() |
||
778 | |||
779 | /** |
||
780 | * Sets a query to be executed |
||
781 | * |
||
782 | * @param string $sql A SphinxQL query to execute |
||
783 | * |
||
784 | * @return SphinxQL |
||
785 | */ |
||
786 | public function query($sql) |
||
793 | |||
794 | /** |
||
795 | * Select the columns |
||
796 | * |
||
797 | * Gets the arguments passed as $sphinxql->select('one', 'two') |
||
798 | * Using it without arguments equals to having '*' as argument |
||
799 | * Using it with array maps values as column names |
||
800 | * |
||
801 | * Examples: |
||
802 | * $query->select('title'); |
||
803 | * // SELECT title |
||
804 | * |
||
805 | * $query->select('title', 'author', 'date'); |
||
806 | * // SELECT title, author, date |
||
807 | * |
||
808 | * $query->select(['id', 'title']); |
||
809 | * // SELECT id, title |
||
810 | * |
||
811 | * @param array|string $columns Array or multiple string arguments containing column names |
||
812 | * |
||
813 | * @return SphinxQL |
||
814 | */ |
||
815 | public function select($columns = null) |
||
828 | |||
829 | /** |
||
830 | * Alters which arguments to select |
||
831 | * |
||
832 | * Query is assumed to be in SELECT mode |
||
833 | * See select() for usage |
||
834 | * |
||
835 | * @param array|string $columns Array or multiple string arguments containing column names |
||
836 | * |
||
837 | * @return SphinxQL |
||
838 | */ |
||
839 | public function setSelect($columns = null) |
||
849 | |||
850 | /** |
||
851 | * |
||
852 | * Get the where array |
||
853 | * |
||
854 | * @return array |
||
855 | */ |
||
856 | public function getWhere() |
||
860 | |||
861 | /** |
||
862 | * Sets the where array |
||
863 | * |
||
864 | * @param array $where |
||
865 | * |
||
866 | * @return SphinxQL |
||
867 | */ |
||
868 | public function setWhere($where) |
||
874 | |||
875 | /** |
||
876 | * Get the columns staged to select |
||
877 | * |
||
878 | * @return array |
||
879 | */ |
||
880 | public function getSelect() |
||
884 | |||
885 | /** |
||
886 | * Activates the INSERT mode |
||
887 | * |
||
888 | * @return SphinxQL |
||
889 | */ |
||
890 | public function insert() |
||
897 | |||
898 | /** |
||
899 | * Activates the REPLACE mode |
||
900 | * |
||
901 | * @return SphinxQL |
||
902 | */ |
||
903 | public function replace() |
||
910 | |||
911 | /** |
||
912 | * Activates the UPDATE mode |
||
913 | * |
||
914 | * @param string $index The index to update into |
||
915 | * |
||
916 | * @return SphinxQL |
||
917 | */ |
||
918 | public function update($index) |
||
926 | |||
927 | /** |
||
928 | * Activates the DELETE mode |
||
929 | * |
||
930 | * @return SphinxQL |
||
931 | */ |
||
932 | public function delete() |
||
939 | |||
940 | /** |
||
941 | * FROM clause (Sphinx-specific since it works with multiple indexes) |
||
942 | * func_get_args()-enabled |
||
943 | * |
||
944 | * @param array $array An array of indexes to use |
||
945 | * |
||
946 | * @return SphinxQL |
||
947 | */ |
||
948 | public function from($array = null) |
||
960 | |||
961 | /** |
||
962 | * MATCH clause (Sphinx-specific) |
||
963 | * |
||
964 | * @param mixed $column The column name (can be array, string, Closure, or Match) |
||
965 | * @param string $value The value |
||
966 | * @param boolean $half Exclude ", |, - control characters from being escaped |
||
967 | * |
||
968 | * @return SphinxQL |
||
969 | */ |
||
970 | public function match($column, $value = null, $half = false) |
||
980 | |||
981 | /** |
||
982 | * WHERE clause |
||
983 | * |
||
984 | * Examples: |
||
985 | * $query->where('column', 'value'); |
||
986 | * // WHERE column = 'value' |
||
987 | * |
||
988 | * $query->where('column', '=', 'value'); |
||
989 | * // WHERE column = 'value' |
||
990 | * |
||
991 | * $query->where('column', '>=', 'value') |
||
992 | * // WHERE column >= 'value' |
||
993 | * |
||
994 | * $query->where('column', 'IN', array('value1', 'value2', 'value3')); |
||
995 | * // WHERE column IN ('value1', 'value2', 'value3') |
||
996 | * |
||
997 | * $query->where('column', 'BETWEEN', array('value1', 'value2')) |
||
998 | * // WHERE column BETWEEN 'value1' AND 'value2' |
||
999 | * // WHERE example BETWEEN 10 AND 100 |
||
1000 | * |
||
1001 | * @param string $column The column name |
||
1002 | * @param Expression|string|null|bool|array|int|float $operator The operator to use (if value is not null, you can |
||
1003 | * use only string) |
||
1004 | * @param Expression|string|null|bool|array|int|float $value The value to check against |
||
1005 | * |
||
1006 | * @return SphinxQL |
||
1007 | */ |
||
1008 | public function where($column, $operator, $value = null) |
||
1023 | |||
1024 | /** |
||
1025 | * GROUP BY clause |
||
1026 | * Adds to the previously added columns |
||
1027 | * |
||
1028 | * @param string $column A column to group by |
||
1029 | * |
||
1030 | * @return SphinxQL |
||
1031 | */ |
||
1032 | public function groupBy($column) |
||
1038 | |||
1039 | /** |
||
1040 | * GROUP N BY clause (SphinxQL-specific) |
||
1041 | * Changes 'GROUP BY' into 'GROUP N BY' |
||
1042 | * |
||
1043 | * @param int $n Number of items per group |
||
1044 | * |
||
1045 | * @return SphinxQL |
||
1046 | */ |
||
1047 | public function groupNBy($n) |
||
1053 | |||
1054 | /** |
||
1055 | * WITHIN GROUP ORDER BY clause (SphinxQL-specific) |
||
1056 | * Adds to the previously added columns |
||
1057 | * Works just like a classic ORDER BY |
||
1058 | * |
||
1059 | * @param string $column The column to group by |
||
1060 | * @param string $direction The group by direction (asc/desc) |
||
1061 | * |
||
1062 | * @return SphinxQL |
||
1063 | */ |
||
1064 | public function withinGroupOrderBy($column, $direction = null) |
||
1070 | |||
1071 | /** |
||
1072 | * HAVING clause |
||
1073 | * |
||
1074 | * Examples: |
||
1075 | * $sq->having('column', 'value'); |
||
1076 | * // HAVING column = 'value' |
||
1077 | * |
||
1078 | * $sq->having('column', '=', 'value'); |
||
1079 | * // HAVING column = 'value' |
||
1080 | * |
||
1081 | * $sq->having('column', '>=', 'value') |
||
1082 | * // HAVING column >= 'value' |
||
1083 | * |
||
1084 | * $sq->having('column', 'IN', array('value1', 'value2', 'value3')); |
||
1085 | * // HAVING column IN ('value1', 'value2', 'value3') |
||
1086 | * |
||
1087 | * $sq->having('column', 'BETWEEN', array('value1', 'value2')) |
||
1088 | * // HAVING column BETWEEN 'value1' AND 'value2' |
||
1089 | * // HAVING example BETWEEN 10 AND 100 |
||
1090 | * |
||
1091 | * @param string $column The column name |
||
1092 | * @param string $operator The operator to use |
||
1093 | * @param string $value The value to check against |
||
1094 | * |
||
1095 | * @return SphinxQL The current object |
||
1096 | */ |
||
1097 | public function having($column, $operator, $value = null) |
||
1112 | |||
1113 | /** |
||
1114 | * ORDER BY clause |
||
1115 | * Adds to the previously added columns |
||
1116 | * |
||
1117 | * @param string $column The column to order on |
||
1118 | * @param string $direction The ordering direction (asc/desc) |
||
1119 | * |
||
1120 | * @return SphinxQL |
||
1121 | */ |
||
1122 | public function orderBy($column, $direction = null) |
||
1128 | |||
1129 | /** |
||
1130 | * LIMIT clause |
||
1131 | * Supports also LIMIT offset, limit |
||
1132 | * |
||
1133 | * @param int $offset Offset if $limit is specified, else limit |
||
1134 | * @param null|int $limit The limit to set, null for no limit |
||
1135 | * |
||
1136 | * @return SphinxQL |
||
1137 | */ |
||
1138 | public function limit($offset, $limit = null) |
||
1150 | |||
1151 | /** |
||
1152 | * OFFSET clause |
||
1153 | * |
||
1154 | * @param int $offset The offset |
||
1155 | * |
||
1156 | * @return SphinxQL |
||
1157 | */ |
||
1158 | public function offset($offset) |
||
1164 | |||
1165 | /** |
||
1166 | * OPTION clause (SphinxQL-specific) |
||
1167 | * Used by: SELECT |
||
1168 | * |
||
1169 | * @param string $name Option name |
||
1170 | * @param Expression|array|string|int|bool|float|null $value Option value |
||
1171 | * |
||
1172 | * @return SphinxQL |
||
1173 | */ |
||
1174 | public function option($name, $value) |
||
1180 | |||
1181 | /** |
||
1182 | * INTO clause |
||
1183 | * Used by: INSERT, REPLACE |
||
1184 | * |
||
1185 | * @param string $index The index to insert/replace into |
||
1186 | * |
||
1187 | * @return SphinxQL |
||
1188 | */ |
||
1189 | public function into($index) |
||
1195 | |||
1196 | /** |
||
1197 | * Set columns |
||
1198 | * Used in: INSERT, REPLACE |
||
1199 | * func_get_args()-enabled |
||
1200 | * |
||
1201 | * @param array $array The array of columns |
||
1202 | * |
||
1203 | * @return SphinxQL |
||
1204 | */ |
||
1205 | public function columns($array = array()) |
||
1215 | |||
1216 | /** |
||
1217 | * Set VALUES |
||
1218 | * Used in: INSERT, REPLACE |
||
1219 | * func_get_args()-enabled |
||
1220 | * |
||
1221 | * @param array $array The array of values matching the columns from $this->columns() |
||
1222 | * |
||
1223 | * @return SphinxQL |
||
1224 | */ |
||
1225 | public function values($array) |
||
1235 | |||
1236 | /** |
||
1237 | * Set column and relative value |
||
1238 | * Used in: INSERT, REPLACE |
||
1239 | * |
||
1240 | * @param string $column The column name |
||
1241 | * @param string $value The value |
||
1242 | * |
||
1243 | * @return SphinxQL |
||
1244 | */ |
||
1245 | public function value($column, $value) |
||
1256 | |||
1257 | /** |
||
1258 | * Allows passing an array with the key as column and value as value |
||
1259 | * Used in: INSERT, REPLACE, UPDATE |
||
1260 | * |
||
1261 | * @param array $array Array of key-values |
||
1262 | * |
||
1263 | * @return SphinxQL |
||
1264 | */ |
||
1265 | public function set($array) |
||
1277 | |||
1278 | /** |
||
1279 | * Allows passing an array with the key as column and value as value |
||
1280 | * Used in: INSERT, REPLACE, UPDATE |
||
1281 | * |
||
1282 | * @param Facet $facet |
||
1283 | * @return SphinxQL |
||
1284 | */ |
||
1285 | public function facet($facet) |
||
1291 | |||
1292 | /** |
||
1293 | * Sets the characters used for escapeMatch(). |
||
1294 | * |
||
1295 | * @param array $array The array of characters to escape |
||
1296 | * |
||
1297 | * @return SphinxQL The escaped characters |
||
1298 | */ |
||
1299 | public function setFullEscapeChars($array = array()) |
||
1307 | |||
1308 | /** |
||
1309 | * Sets the characters used for halfEscapeMatch(). |
||
1310 | * |
||
1311 | * @param array $array The array of characters to escape |
||
1312 | * |
||
1313 | * @return SphinxQL The escaped characters |
||
1314 | */ |
||
1315 | public function setHalfEscapeChars($array = array()) |
||
1323 | |||
1324 | /** |
||
1325 | * Compiles an array containing the characters and escaped characters into a key/value configuration. |
||
1326 | * |
||
1327 | * @param array $array The array of characters to escape |
||
1328 | * |
||
1329 | * @return array An array of the characters and it's escaped counterpart |
||
1330 | */ |
||
1331 | public function compileEscapeChars($array = array()) |
||
1340 | |||
1341 | /** |
||
1342 | * Escapes the query for the MATCH() function |
||
1343 | * |
||
1344 | * @param string $string The string to escape for the MATCH |
||
1345 | * |
||
1346 | * @return string The escaped string |
||
1347 | */ |
||
1348 | public function escapeMatch($string) |
||
1356 | |||
1357 | /** |
||
1358 | * Escapes the query for the MATCH() function |
||
1359 | * Allows some of the control characters to pass through for use with a search field: -, |, " |
||
1360 | * It also does some tricks to wrap/unwrap within " the string and prevents errors |
||
1361 | * |
||
1362 | * @param string $string The string to escape for the MATCH |
||
1363 | * |
||
1364 | * @return string The escaped string |
||
1365 | */ |
||
1366 | public function halfEscapeMatch($string) |
||
1392 | |||
1393 | /** |
||
1394 | * Clears the existing query build for new query when using the same SphinxQL instance. |
||
1395 | * |
||
1396 | * @return SphinxQL |
||
1397 | */ |
||
1398 | public function reset() |
||
1420 | |||
1421 | public function resetWhere() |
||
1427 | |||
1428 | public function resetMatch() |
||
1434 | |||
1435 | public function resetGroupBy() |
||
1442 | |||
1443 | public function resetWithinGroupOrderBy() |
||
1449 | |||
1450 | public function resetHaving() |
||
1456 | |||
1457 | public function resetOrderBy() |
||
1463 | |||
1464 | public function resetOptions() |
||
1470 | } |
||
1471 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.