| Conditions | 1 |
| Paths | 1 |
| Total Lines | 132 |
| Code Lines | 87 |
| 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 |
||
| 9 | public function buttonProvider(): array |
||
| 10 | { |
||
| 11 | return [ |
||
| 12 | [ |
||
| 13 | 'test', |
||
| 14 | [ |
||
| 15 | 'before' => [ |
||
| 16 | 'inserted_test' => [ |
||
| 17 | 'href' => 'link', |
||
| 18 | 'show' => true, |
||
| 19 | ], |
||
| 20 | 'test' => [ |
||
| 21 | 'href' => 'link', |
||
| 22 | 'show' => true, |
||
| 23 | ], |
||
| 24 | 'test1' => [ |
||
| 25 | 'href' => 'link1', |
||
| 26 | 'show' => true, |
||
| 27 | ], |
||
| 28 | ], |
||
| 29 | 'after' => [ |
||
| 30 | 'test' => [ |
||
| 31 | 'href' => 'link', |
||
| 32 | 'show' => true, |
||
| 33 | ], |
||
| 34 | 'inserted_test' => [ |
||
| 35 | 'href' => 'link', |
||
| 36 | 'show' => true, |
||
| 37 | ], |
||
| 38 | 'test1' => [ |
||
| 39 | 'href' => 'link1', |
||
| 40 | 'show' => true, |
||
| 41 | ], |
||
| 42 | ], |
||
| 43 | 'child_of' => [ |
||
| 44 | 'test' => [ |
||
| 45 | 'href' => 'link', |
||
| 46 | 'show' => true, |
||
| 47 | 'sub_buttons' => [ |
||
| 48 | 'inserted_test' => [ |
||
| 49 | 'href' => 'link', |
||
| 50 | 'show' => true, |
||
| 51 | ], |
||
| 52 | ], |
||
| 53 | ], |
||
| 54 | 'test1' => [ |
||
| 55 | 'href' => 'link1', |
||
| 56 | 'show' => true, |
||
| 57 | ], |
||
| 58 | ], |
||
| 59 | ], |
||
| 60 | ], |
||
| 61 | [ |
||
| 62 | 'test1', |
||
| 63 | [ |
||
| 64 | 'before' => [ |
||
| 65 | 'test' => [ |
||
| 66 | 'href' => 'link', |
||
| 67 | 'show' => true, |
||
| 68 | ], |
||
| 69 | 'inserted_test1' => [ |
||
| 70 | 'href' => 'link', |
||
| 71 | 'show' => true, |
||
| 72 | ], |
||
| 73 | 'test1' => [ |
||
| 74 | 'href' => 'link1', |
||
| 75 | 'show' => true, |
||
| 76 | ], |
||
| 77 | ], |
||
| 78 | 'after' => [ |
||
| 79 | 'test' => [ |
||
| 80 | 'href' => 'link', |
||
| 81 | 'show' => true, |
||
| 82 | ], |
||
| 83 | 'test1' => [ |
||
| 84 | 'href' => 'link1', |
||
| 85 | 'show' => true, |
||
| 86 | ], |
||
| 87 | 'inserted_test1' => [ |
||
| 88 | 'href' => 'link', |
||
| 89 | 'show' => true, |
||
| 90 | ], |
||
| 91 | ], |
||
| 92 | 'child_of' => [ |
||
| 93 | 'test' => [ |
||
| 94 | 'href' => 'link', |
||
| 95 | 'show' => true, |
||
| 96 | ], |
||
| 97 | 'test1' => [ |
||
| 98 | 'href' => 'link1', |
||
| 99 | 'show' => true, |
||
| 100 | 'sub_buttons' => [ |
||
| 101 | 'inserted_test1' => [ |
||
| 102 | 'href' => 'link', |
||
| 103 | 'show' => true, |
||
| 104 | ], |
||
| 105 | ], |
||
| 106 | ], |
||
| 107 | ], |
||
| 108 | ], |
||
| 109 | ], |
||
| 110 | [ |
||
| 111 | 'dungeon', |
||
| 112 | [ |
||
| 113 | 'before' => [ |
||
| 114 | 'test' => [ |
||
| 115 | 'href' => 'link', |
||
| 116 | 'show' => true, |
||
| 117 | ], |
||
| 118 | 'test1' => [ |
||
| 119 | 'href' => 'link1', |
||
| 120 | 'show' => true, |
||
| 121 | ], |
||
| 122 | ], |
||
| 123 | 'after' => [ |
||
| 124 | 'test' => [ |
||
| 125 | 'href' => 'link', |
||
| 126 | 'show' => true, |
||
| 127 | ], |
||
| 128 | 'test1' => [ |
||
| 129 | 'href' => 'link1', |
||
| 130 | 'show' => true, |
||
| 131 | ], |
||
| 132 | ], |
||
| 133 | 'child_of' => [ |
||
| 134 | 'test' => [ |
||
| 135 | 'href' => 'link', |
||
| 136 | 'show' => true, |
||
| 137 | ], |
||
| 138 | 'test1' => [ |
||
| 139 | 'href' => 'link1', |
||
| 140 | 'show' => true, |
||
| 141 | ], |
||
| 435 |