Conditions | 1 |
Paths | 1 |
Total Lines | 64 |
Code Lines | 30 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
219 | public function callPqProvider() |
||
220 | { |
||
221 | /** |
||
222 | * 1) Call PQ |
||
223 | * 2) Document empty |
||
224 | * 3) Index empty |
||
225 | * 4) Documents array of string |
||
226 | * 5) Documents associate array |
||
227 | * 6) Documents array of associate array |
||
228 | * 7) Documents jsonObject |
||
229 | * 8) Documents jsonArray of jsonObject |
||
230 | * 9) Documents phpArray of jsonObject |
||
231 | * 10) Option OPTION_QUERY |
||
232 | * 11) Option OPTION_DOCS |
||
233 | * Throws OPTION_DOCS_JSON |
||
234 | * 12) Not json string |
||
235 | * 13) Not array with non json string |
||
236 | */ |
||
237 | |||
238 | |||
239 | return [ |
||
240 | [1, 'pq', 'full text query terms', [Percolate::OPTION_QUERY => 1], ['full text query terms', 2]], |
||
241 | [2, 'pq', '', [], null], |
||
242 | [3, '', 'full', [], null], |
||
243 | [ |
||
244 | 4, |
||
245 | 'pq', |
||
246 | ['query terms', 'full text query terms'], |
||
247 | [Percolate::OPTION_QUERY => 1], |
||
248 | ['full text query terms', 2] |
||
249 | ], |
||
250 | [5, 'pq', ['subject' => 'document about orange'], [Percolate::OPTION_QUERY => 1], ['@subject orange', 2]], |
||
251 | [ |
||
252 | 6, |
||
253 | 'pq', |
||
254 | [['subject' => 'document about orange'], ['subject' => 'match by field', 'price' => 1]], |
||
255 | [Percolate::OPTION_QUERY => 1], |
||
256 | ['@subject orange', 2] |
||
257 | ], |
||
258 | [7, 'pq', '{"subject":"document about orange"}', [Percolate::OPTION_QUERY => 1], ['@subject orange', 2]], |
||
259 | [ |
||
260 | 8, |
||
261 | 'pq', |
||
262 | '[{"subject":"document about orange"}, {"subject":"match by field","price":10}]', |
||
263 | [Percolate::OPTION_QUERY => 1], |
||
264 | ['@subject match by field', 3] |
||
265 | ], |
||
266 | [ |
||
267 | 9, |
||
268 | 'pq', |
||
269 | ['{"subject":"document about orange"}', '{"subject":"match by field","price":10}'], |
||
270 | [Percolate::OPTION_QUERY => 1], |
||
271 | ['@subject match by field', 3] |
||
272 | ], |
||
273 | [10, 'pq', 'full text query terms', [Percolate::OPTION_QUERY => 0], [1, 2]], |
||
274 | [ |
||
275 | 11, |
||
276 | 'pq', |
||
277 | ['{"subject":"document about orange"}', '{"subject":"match by field","price":10}'], |
||
278 | [Percolate::OPTION_QUERY => 1, Percolate::OPTION_DOCS => 1], |
||
279 | ['@subject match by field', 3] |
||
280 | ], |
||
281 | [12, 'pq', 'full text query terms', [Percolate::OPTION_DOCS_JSON => 1], null], |
||
282 | [13, 'pq', ['full text query terms','full text'], [Percolate::OPTION_DOCS_JSON => 1], null], |
||
283 | ]; |
||
287 |