Conditions | 1 |
Paths | 1 |
Total Lines | 117 |
Code Lines | 77 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
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 |
||
107 | public function childButtonProvider(): array |
||
108 | { |
||
109 | $btn = ['href' => 'link', 'show' => true]; |
||
110 | return [ |
||
111 | [ |
||
112 | 'sub', |
||
113 | [ |
||
114 | 'before' => [ |
||
115 | 'test' => [ |
||
116 | 'href' => 'link', |
||
117 | 'show' => true, |
||
118 | 'sub_buttons' => [ |
||
119 | 'inserted_sub' => $btn, |
||
120 | 'sub' => $btn , |
||
121 | 'sub1' => $btn, |
||
122 | ], |
||
123 | ], |
||
124 | ], |
||
125 | 'after' => [ |
||
126 | 'test' => [ |
||
127 | 'href' => 'link', |
||
128 | 'show' => true, |
||
129 | 'sub_buttons' => [ |
||
130 | 'sub' => $btn, |
||
131 | 'inserted_sub' => $btn, |
||
132 | 'sub1' => $btn, |
||
133 | ], |
||
134 | ], |
||
135 | ], |
||
136 | 'child_of' => [ |
||
137 | 'test' => [ |
||
138 | 'href' => 'link', |
||
139 | 'show' => true, |
||
140 | 'sub_buttons' => [ |
||
141 | 'sub' => [ |
||
142 | 'href' => 'link', |
||
143 | 'show' => true, |
||
144 | 'sub_buttons' => [ |
||
145 | 'inserted_sub' => $btn, |
||
146 | ], |
||
147 | ], |
||
148 | 'sub1' => $btn, |
||
149 | ], |
||
150 | ], |
||
151 | ], |
||
152 | ], |
||
153 | ], |
||
154 | [ |
||
155 | 'sub1', |
||
156 | [ |
||
157 | 'before' => [ |
||
158 | 'test' => [ |
||
159 | 'href' => 'link', |
||
160 | 'show' => true, |
||
161 | 'sub_buttons' => [ |
||
162 | 'sub' => $btn, |
||
163 | 'inserted_sub1' => $btn, |
||
164 | 'sub1' => $btn, |
||
165 | ], |
||
166 | ], |
||
167 | ], |
||
168 | 'after' => [ |
||
169 | 'test' => [ |
||
170 | 'href' => 'link', |
||
171 | 'show' => true, |
||
172 | 'sub_buttons' => [ |
||
173 | 'sub' => $btn, |
||
174 | 'sub1' => $btn, |
||
175 | 'inserted_sub1' => $btn, |
||
176 | ], |
||
177 | ], |
||
178 | ], |
||
179 | 'child_of' => [ |
||
180 | 'test' => [ |
||
181 | 'href' => 'link', |
||
182 | 'show' => true, |
||
183 | 'sub_buttons' => [ |
||
184 | 'sub' => $btn, |
||
185 | 'sub1' => [ |
||
186 | 'href' => 'link', |
||
187 | 'show' => true, |
||
188 | 'sub_buttons' => [ |
||
189 | 'inserted_sub1' => $btn, |
||
190 | ], |
||
191 | ], |
||
192 | ], |
||
193 | ], |
||
194 | ], |
||
195 | ], |
||
196 | ], |
||
197 | [ |
||
198 | 'dungeon', |
||
199 | [ |
||
200 | 'before' => [ |
||
201 | 'test' => [ |
||
202 | 'href' => 'link', |
||
203 | 'show' => true, |
||
204 | 'sub_buttons' => [ |
||
205 | 'sub' => $btn, 'sub1' => $btn, |
||
206 | ], |
||
207 | ], |
||
208 | ], |
||
209 | 'after' => [ |
||
210 | 'test' => [ |
||
211 | 'href' => 'link', |
||
212 | 'show' => true, |
||
213 | 'sub_buttons' => [ |
||
214 | 'sub' => $btn, 'sub1' => $btn, |
||
215 | ], |
||
216 | ], |
||
217 | ], |
||
218 | 'child_of' => [ |
||
219 | 'test' => [ |
||
220 | 'href' => 'link', |
||
221 | 'show' => true, |
||
222 | 'sub_buttons' => [ |
||
223 | 'sub' => $btn, 'sub1' => $btn, |
||
224 | ], |
||
350 |