| Conditions | 1 |
| Paths | 1 |
| Total Lines | 184 |
| Code Lines | 123 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 179 | public function childButtonProvider(): array |
||
| 180 | { |
||
| 181 | return [ |
||
| 182 | [ |
||
| 183 | 'sub', |
||
| 184 | [ |
||
| 185 | 'before' => [ |
||
| 186 | 'test' => [ |
||
| 187 | 'href' => 'link', |
||
| 188 | 'show' => true, |
||
| 189 | 'sub_buttons' => [ |
||
| 190 | 'inserted_sub' => [ |
||
| 191 | 'href' => 'link', |
||
| 192 | 'show' => true, |
||
| 193 | ], |
||
| 194 | 'sub' => [ |
||
| 195 | 'href' => 'link', |
||
| 196 | 'show' => true, |
||
| 197 | ], |
||
| 198 | 'sub1' => [ |
||
| 199 | 'href' => 'link', |
||
| 200 | 'show' => true, |
||
| 201 | ], |
||
| 202 | ], |
||
| 203 | ], |
||
| 204 | ], |
||
| 205 | 'after' => [ |
||
| 206 | 'test' => [ |
||
| 207 | 'href' => 'link', |
||
| 208 | 'show' => true, |
||
| 209 | 'sub_buttons' => [ |
||
| 210 | 'sub' => [ |
||
| 211 | 'href' => 'link', |
||
| 212 | 'show' => true, |
||
| 213 | ], |
||
| 214 | 'inserted_sub' => [ |
||
| 215 | 'href' => 'link', |
||
| 216 | 'show' => true, |
||
| 217 | ], |
||
| 218 | 'sub1' => [ |
||
| 219 | 'href' => 'link', |
||
| 220 | 'show' => true, |
||
| 221 | ], |
||
| 222 | ], |
||
| 223 | ], |
||
| 224 | ], |
||
| 225 | 'child_of' => [ |
||
| 226 | 'test' => [ |
||
| 227 | 'href' => 'link', |
||
| 228 | 'show' => true, |
||
| 229 | 'sub_buttons' => [ |
||
| 230 | 'sub' => [ |
||
| 231 | 'href' => 'link', |
||
| 232 | 'show' => true, |
||
| 233 | 'sub_buttons' => [ |
||
| 234 | 'inserted_sub' => [ |
||
| 235 | 'href' => 'link', |
||
| 236 | 'show' => true, |
||
| 237 | ], |
||
| 238 | ], |
||
| 239 | ], |
||
| 240 | 'sub1' => [ |
||
| 241 | 'href' => 'link', |
||
| 242 | 'show' => true, |
||
| 243 | ], |
||
| 244 | ], |
||
| 245 | ], |
||
| 246 | ], |
||
| 247 | ], |
||
| 248 | ], |
||
| 249 | [ |
||
| 250 | 'sub1', |
||
| 251 | [ |
||
| 252 | 'before' => [ |
||
| 253 | 'test' => [ |
||
| 254 | 'href' => 'link', |
||
| 255 | 'show' => true, |
||
| 256 | 'sub_buttons' => [ |
||
| 257 | 'sub' => [ |
||
| 258 | 'href' => 'link', |
||
| 259 | 'show' => true, |
||
| 260 | ], |
||
| 261 | 'inserted_sub1' => [ |
||
| 262 | 'href' => 'link', |
||
| 263 | 'show' => true, |
||
| 264 | ], |
||
| 265 | 'sub1' => [ |
||
| 266 | 'href' => 'link', |
||
| 267 | 'show' => true, |
||
| 268 | ], |
||
| 269 | ], |
||
| 270 | ], |
||
| 271 | ], |
||
| 272 | 'after' => [ |
||
| 273 | 'test' => [ |
||
| 274 | 'href' => 'link', |
||
| 275 | 'show' => true, |
||
| 276 | 'sub_buttons' => [ |
||
| 277 | 'sub' => [ |
||
| 278 | 'href' => 'link', |
||
| 279 | 'show' => true, |
||
| 280 | ], |
||
| 281 | 'sub1' => [ |
||
| 282 | 'href' => 'link', |
||
| 283 | 'show' => true, |
||
| 284 | ], |
||
| 285 | 'inserted_sub1' => [ |
||
| 286 | 'href' => 'link', |
||
| 287 | 'show' => true, |
||
| 288 | ], |
||
| 289 | ], |
||
| 290 | ], |
||
| 291 | ], |
||
| 292 | 'child_of' => [ |
||
| 293 | 'test' => [ |
||
| 294 | 'href' => 'link', |
||
| 295 | 'show' => true, |
||
| 296 | 'sub_buttons' => [ |
||
| 297 | 'sub' => [ |
||
| 298 | 'href' => 'link', |
||
| 299 | 'show' => true, |
||
| 300 | ], |
||
| 301 | 'sub1' => [ |
||
| 302 | 'href' => 'link', |
||
| 303 | 'show' => true, |
||
| 304 | 'sub_buttons' => [ |
||
| 305 | 'inserted_sub1' => [ |
||
| 306 | 'href' => 'link', |
||
| 307 | 'show' => true, |
||
| 308 | ], |
||
| 309 | ], |
||
| 310 | ], |
||
| 311 | ], |
||
| 312 | ], |
||
| 313 | ], |
||
| 314 | ], |
||
| 315 | ], |
||
| 316 | [ |
||
| 317 | 'dungeon', |
||
| 318 | [ |
||
| 319 | 'before' => [ |
||
| 320 | 'test' => [ |
||
| 321 | 'href' => 'link', |
||
| 322 | 'show' => true, |
||
| 323 | 'sub_buttons' => [ |
||
| 324 | 'sub' => [ |
||
| 325 | 'href' => 'link', |
||
| 326 | 'show' => true, |
||
| 327 | ], |
||
| 328 | 'sub1' => [ |
||
| 329 | 'href' => 'link', |
||
| 330 | 'show' => true, |
||
| 331 | ], |
||
| 332 | ], |
||
| 333 | ], |
||
| 334 | ], |
||
| 335 | 'after' => [ |
||
| 336 | 'test' => [ |
||
| 337 | 'href' => 'link', |
||
| 338 | 'show' => true, |
||
| 339 | 'sub_buttons' => [ |
||
| 340 | 'sub' => [ |
||
| 341 | 'href' => 'link', |
||
| 342 | 'show' => true, |
||
| 343 | ], |
||
| 344 | 'sub1' => [ |
||
| 345 | 'href' => 'link', |
||
| 346 | 'show' => true, |
||
| 347 | ], |
||
| 348 | ], |
||
| 349 | ], |
||
| 350 | ], |
||
| 351 | 'child_of' => [ |
||
| 352 | 'test' => [ |
||
| 353 | 'href' => 'link', |
||
| 354 | 'show' => true, |
||
| 355 | 'sub_buttons' => [ |
||
| 356 | 'sub' => [ |
||
| 357 | 'href' => 'link', |
||
| 358 | 'show' => true, |
||
| 359 | ], |
||
| 360 | 'sub1' => [ |
||
| 361 | 'href' => 'link', |
||
| 362 | 'show' => true, |
||
| 363 | ], |
||
| 435 |