Conditions | 1 |
Paths | 1 |
Total Lines | 81 |
Code Lines | 44 |
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 |
||
192 | public function diffProvider() |
||
193 | { |
||
194 | return [ |
||
195 | // [ 1st table option string, 2nd table option string, expected result ] |
||
196 | |||
197 | // AVG_ROW_LENGTH |
||
198 | ["", "avg_row_length=100", "AVG_ROW_LENGTH=100"], |
||
199 | ["avg_row_length=200", "", "AVG_ROW_LENGTH=0"], |
||
200 | ["avg_row_length=100", "avg_row_length=200", "AVG_ROW_LENGTH=200"], |
||
201 | |||
202 | // CHARSET |
||
203 | ["", "charset latin1", "DEFAULT CHARSET=latin1"], |
||
204 | ["charset latin1", "", ""], |
||
205 | ["charset default", "charset utf8", "DEFAULT CHARSET=utf8"], |
||
206 | |||
207 | // COLLATE |
||
208 | ["", "collate=utf8_unicode_ci", "DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"], |
||
209 | ["collate=utf8_unicode_ci", "", ""], |
||
210 | ["collate=utf8_unicode_ci", "collate=latin1_german1_ci", "DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci"], |
||
211 | |||
212 | // CHECKSUM |
||
213 | ["", "checksum=1", "CHECKSUM=1"], |
||
214 | ["checksum=1", "", "CHECKSUM=0"], |
||
215 | ["checksum=1", "checksum=0", "CHECKSUM=0"], |
||
216 | |||
217 | // COMMENT |
||
218 | ["comment 'hello'", "", "COMMENT=''"], |
||
219 | ["", "comment 'hello'", "COMMENT='hello'"], |
||
220 | ["comment 'hello'", "comment 'goodbye'", "COMMENT='goodbye'"], |
||
221 | |||
222 | // CONNECTION |
||
223 | ["connection 'foo'", "", "CONNECTION=''" ], |
||
224 | ["", "connection 'foo'", "CONNECTION='foo'"], |
||
225 | ["connection 'foo'", "connection 'bar'", "CONNECTION='bar'"], |
||
226 | |||
227 | // DELAY_KEY_WRITE |
||
228 | ["", "delay_key_write=1", "DELAY_KEY_WRITE=1"], |
||
229 | ["delay_key_write=1", "", "DELAY_KEY_WRITE=0"], |
||
230 | ["delay_key_write=1", "delay_key_write=0", "DELAY_KEY_WRITE=0"], |
||
231 | |||
232 | // ENGINE |
||
233 | ["", "engine=memory", "ENGINE=MEMORY"], |
||
234 | ["engine=InnoDB", "", ""], |
||
235 | ["engine=InnoDB", "engine=MyISAM", "ENGINE=MyISAM"], |
||
236 | |||
237 | // KEY_BLOCK_SIZE |
||
238 | ["", "key_block_size=4", "KEY_BLOCK_SIZE=4"], |
||
239 | ["key_block_size=8", "", "KEY_BLOCK_SIZE=0"], |
||
240 | ["key_block_size=4", "key_block_size=16", "KEY_BLOCK_SIZE=16"], |
||
241 | |||
242 | // MAX_ROWS |
||
243 | ["", "max_rows=100", "MAX_ROWS=100"], |
||
244 | ["max_rows=200", "", "MAX_ROWS=0"], |
||
245 | ["max_rows=100", "max_rows=200", "MAX_ROWS=200"], |
||
246 | |||
247 | // MIN_ROWS |
||
248 | ["", "min_rows=100", "MIN_ROWS=100"], |
||
249 | ["min_rows=200", "", "MIN_ROWS=0"], |
||
250 | ["min_rows=100", "min_rows=200", "MIN_ROWS=200"], |
||
251 | |||
252 | // PACK_KEYS |
||
253 | ["", "pack_keys=1", "PACK_KEYS=1"], |
||
254 | ["pack_keys=0", "", "PACK_KEYS=DEFAULT"], |
||
255 | ["pack_keys=1", "pack_keys=default", "PACK_KEYS=DEFAULT"], |
||
256 | |||
257 | /* |
||
258 | * Everything below here is currently unsupported by the |
||
259 | * diff() function and so has an expected value of an empty string. |
||
260 | * These should be moved up as and when support is added. |
||
261 | */ |
||
262 | |||
263 | // AUTO_INCREMENT |
||
264 | ["", "auto_increment 1", ""], |
||
265 | ["", "auto_increment 5", ""], |
||
266 | ["auto_increment 1", "", ""], |
||
267 | ["auto_increment 3", "auto_increment 5", ""], |
||
268 | |||
269 | // ROW_FORMAT |
||
270 | ["", "row_format=compressed", ""], |
||
271 | ["row_format=fixed", "", ""], |
||
272 | ["row_format=compact", "row_format=redundant", ""] |
||
273 | ]; |
||
292 |