Conditions | 1 |
Paths | 1 |
Total Lines | 62 |
Code Lines | 49 |
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 |
||
18 | public function successProvider(): array |
||
19 | { |
||
20 | return [ |
||
21 | 'param-unnamed-auto-null' => [ |
||
22 | [null], |
||
23 | Params::ALL_AUTO, |
||
24 | [[null, PDO::PARAM_NULL]], |
||
25 | true, |
||
26 | ], |
||
27 | 'param-unnamed-auto-int' => [ |
||
28 | [2], |
||
29 | Params::ALL_AUTO, |
||
30 | [[2, PDO::PARAM_INT]], |
||
31 | true, |
||
32 | ], |
||
33 | 'param-unnamed-auto-false' => [ |
||
34 | [false], |
||
35 | Params::ALL_AUTO, |
||
36 | [[false, PDO::PARAM_BOOL]], |
||
37 | true, |
||
38 | ], |
||
39 | 'param-unnamed-auto-true' => [ |
||
40 | [true], |
||
41 | Params::ALL_AUTO, |
||
42 | [[true, PDO::PARAM_BOOL]], |
||
43 | true, |
||
44 | ], |
||
45 | 'param-unnamed-auto-str' => [ |
||
46 | ['bar'], |
||
47 | Params::ALL_AUTO, |
||
48 | [['bar', PDO::PARAM_STR]], |
||
49 | true, |
||
50 | ], |
||
51 | 'param-unnamed-str' => [ |
||
52 | [2], |
||
53 | Params::ALL_STRING, |
||
54 | [[2, PDO::PARAM_STR]], |
||
55 | true, |
||
56 | ], |
||
57 | 'param-unnamed-manual' => [ |
||
58 | [[2, PDO::PARAM_BOOL]], |
||
59 | Params::ALL_MANUAL, |
||
60 | [[2, PDO::PARAM_BOOL]], |
||
61 | true, |
||
62 | ], |
||
63 | 'param-named-auto' => [ |
||
64 | ['foo' => 2], |
||
65 | Params::ALL_AUTO, |
||
66 | ['foo' => [2, PDO::PARAM_INT]], |
||
67 | false, |
||
68 | ], |
||
69 | 'param-named-str' => [ |
||
70 | ['foo' => 2], |
||
71 | Params::ALL_STRING, |
||
72 | ['foo' => [2, PDO::PARAM_STR]], |
||
73 | false, |
||
74 | ], |
||
75 | 'param-named-manual' => [ |
||
76 | ['foo' => [2, PDO::PARAM_BOOL]], |
||
77 | Params::ALL_MANUAL, |
||
78 | ['foo' => [2, PDO::PARAM_BOOL]], |
||
79 | false, |
||
80 | ], |
||
145 |