Conditions | 1 |
Paths | 1 |
Total Lines | 59 |
Code Lines | 21 |
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 |
||
31 | public function statementProvider() |
||
32 | { |
||
33 | return [ |
||
34 | [':86:This is a test', ''], |
||
35 | [ |
||
36 | ' |
||
37 | :86:This is a test', |
||
38 | 'This is a test', |
||
39 | ], |
||
40 | [ |
||
41 | ' |
||
42 | :86:This is a test |
||
43 | ', |
||
44 | 'This is a test', |
||
45 | ], |
||
46 | [ |
||
47 | ' |
||
48 | :86:This is a test |
||
49 | :', |
||
50 | 'This is a test:', |
||
51 | ], |
||
52 | [ |
||
53 | ' |
||
54 | :86:This is a test |
||
55 | :6', |
||
56 | 'This is a test:6', |
||
57 | ], |
||
58 | [ |
||
59 | ' |
||
60 | :86:This is a test |
||
61 | :61', |
||
62 | 'This is a test', |
||
63 | ], |
||
64 | [ |
||
65 | ' |
||
66 | :86:This is a test |
||
67 | :62', |
||
68 | 'This is a test', |
||
69 | ], |
||
70 | [ |
||
71 | ' |
||
72 | :86:This is a test |
||
73 | : 62', |
||
74 | 'This is a test: 62', |
||
75 | ], |
||
76 | [ |
||
77 | ' |
||
78 | :86:Spaarpot kantine', |
||
79 | 'Spaarpot kantine', |
||
80 | ], |
||
81 | [ |
||
82 | ' |
||
83 | :86: ABN AMRO BANK>AMSTERDAM S1P468 |
||
84 | 22072010 09:57 002 5595781 |
||
85 | ', |
||
86 | 'ABN AMRO BANK>AMSTERDAM S1P46822072010 09:57 002 5595781', |
||
87 | ], |
||
88 | ]; |
||
89 | } |
||
90 | } |
||
91 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.