| Conditions | 1 |
| Paths | 1 |
| Total Lines | 71 |
| Code Lines | 48 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 216 | public function getParametersProvider() |
||
| 217 | { |
||
| 218 | return [ |
||
| 219 | [ |
||
| 220 | 'CREATE PROCEDURE `foo`() SET @A=0', |
||
| 221 | [ |
||
| 222 | 'num' => 0, |
||
| 223 | 'dir' => [], |
||
| 224 | 'name' => [], |
||
| 225 | 'type' => [], |
||
| 226 | 'length' => [], |
||
| 227 | 'length_arr' => [], |
||
| 228 | 'opts' => [], |
||
| 229 | ], |
||
| 230 | ], |
||
| 231 | [ |
||
| 232 | 'CREATE DEFINER=`user\\`@`somehost``(` FUNCTION `foo```(`baz` INT) BEGIN SELECT NULL; END', |
||
| 233 | [ |
||
| 234 | 'num' => 1, |
||
| 235 | 'dir' => [0 => ''], |
||
| 236 | 'name' => [0 => 'baz'], |
||
| 237 | 'type' => [0 => 'INT'], |
||
| 238 | 'length' => [0 => ''], |
||
| 239 | 'length_arr' => [ |
||
| 240 | 0 => [], |
||
| 241 | ], |
||
| 242 | 'opts' => [0 => ''], |
||
| 243 | ], |
||
| 244 | ], |
||
| 245 | [ |
||
| 246 | 'CREATE PROCEDURE `foo`(IN `baz\\)` INT(25) zerofill unsigned) BEGIN SELECT NULL; END', |
||
| 247 | [ |
||
| 248 | 'num' => 1, |
||
| 249 | 'dir' => [0 => 'IN'], |
||
| 250 | 'name' => [0 => 'baz\\)'], |
||
| 251 | 'type' => [0 => 'INT'], |
||
| 252 | 'length' => [0 => '25'], |
||
| 253 | 'length_arr' => [ |
||
| 254 | 0 => ['25'], |
||
| 255 | ], |
||
| 256 | 'opts' => [0 => 'UNSIGNED ZEROFILL'], |
||
| 257 | ], |
||
| 258 | ], |
||
| 259 | [ |
||
| 260 | 'CREATE PROCEDURE `foo`(IN `baz\\` INT(001) zerofill, out bazz varchar(15) charset utf8) ' . |
||
| 261 | 'BEGIN SELECT NULL; END', |
||
| 262 | [ |
||
| 263 | 'num' => 2, |
||
| 264 | 'dir' => [ |
||
| 265 | 0 => 'IN', |
||
| 266 | 1 => 'OUT', |
||
| 267 | ], |
||
| 268 | 'name' => [ |
||
| 269 | 0 => 'baz\\', |
||
| 270 | 1 => 'bazz', |
||
| 271 | ], |
||
| 272 | 'type' => [ |
||
| 273 | 0 => 'INT', |
||
| 274 | 1 => 'VARCHAR', |
||
| 275 | ], |
||
| 276 | 'length' => [ |
||
| 277 | 0 => '1', |
||
| 278 | 1 => '15', |
||
| 279 | ], |
||
| 280 | 'length_arr' => [ |
||
| 281 | 0 => ['1'], |
||
| 282 | 1 => ['15'], |
||
| 283 | ], |
||
| 284 | 'opts' => [ |
||
| 285 | 0 => 'ZEROFILL', |
||
| 286 | 1 => 'utf8', |
||
| 287 | ], |
||
| 293 |