Conditions | 1 |
Paths | 1 |
Total Lines | 67 |
Code Lines | 25 |
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 |
||
55 | public function transformationUrlsProvider() |
||
56 | { |
||
57 | return [ |
||
58 | [ |
||
59 | // protocol change |
||
60 | false, |
||
61 | [ |
||
62 | 'http://some-locale/some-page/', |
||
63 | ], |
||
64 | [ |
||
65 | 'http://some-locale/some-page/', |
||
66 | ], |
||
67 | ], |
||
68 | [ |
||
69 | // protocol change |
||
70 | true, |
||
71 | [ |
||
72 | 'http://some-locale/some-page/', |
||
73 | ], |
||
74 | [ |
||
75 | 'https://some-locale/some-page/', |
||
76 | ], |
||
77 | ], |
||
78 | [ |
||
79 | // removal of stage params |
||
80 | false, |
||
81 | [ |
||
82 | 'http://some-locale/some-page/?stage=Stage', |
||
83 | 'http://some-locale/some-page/?stage=Live', |
||
84 | 'https://some-locale/some-page/?stage=Live&deviceContext=mobile', |
||
85 | ], |
||
86 | [ |
||
87 | 'http://some-locale/some-page/', |
||
88 | 'https://some-locale/some-page/?deviceContext=mobile', |
||
89 | ], |
||
90 | ], |
||
91 | [ |
||
92 | // removal of stage params |
||
93 | true, |
||
94 | [ |
||
95 | 'http://some-locale/some-page/?stage=Stage', |
||
96 | 'http://some-locale/some-page/?stage=Live', |
||
97 | 'https://some-locale/some-page/?stage=Live&deviceContext=mobile', |
||
98 | ], |
||
99 | [ |
||
100 | 'https://some-locale/some-page/', |
||
101 | 'https://some-locale/some-page/?deviceContext=mobile', |
||
102 | ], |
||
103 | ], |
||
104 | [ |
||
105 | // enforce trailing slash |
||
106 | false, |
||
107 | [ |
||
108 | 'http://some-locale/some-page', |
||
109 | ], |
||
110 | [ |
||
111 | 'http://some-locale/some-page/', |
||
112 | ], |
||
113 | ], |
||
114 | [ |
||
115 | // enforce trailing slash |
||
116 | true, |
||
117 | [ |
||
118 | 'http://some-locale/some-page', |
||
119 | ], |
||
120 | [ |
||
121 | 'https://some-locale/some-page/', |
||
122 | ], |
||
155 |