| Conditions | 1 |
| Paths | 1 |
| Total Lines | 123 |
| Code Lines | 84 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 71 | function getConfig() |
||
| 72 | { |
||
| 73 | return [ |
||
| 74 | 'blockformats' => [ |
||
| 75 | 'Paragraph' => 'p', |
||
| 76 | 'Heading 1' => 'h1', |
||
| 77 | 'Heading 2' => 'h2', |
||
| 78 | 'Heading 3' => 'h3', |
||
| 79 | 'Heading 4' => 'h4', |
||
| 80 | 'Heading 5' => 'h5', |
||
| 81 | 'Heading 6' => 'h6' |
||
| 82 | ], |
||
| 83 | 'styleformats' => [ |
||
| 84 | [ |
||
| 85 | 'title' => 'Headings', |
||
| 86 | 'icon' => '', |
||
| 87 | 'items' => [ |
||
| 88 | [ |
||
| 89 | 'title' => 'Heading 1', |
||
| 90 | 'classes' => 'h1', |
||
| 91 | 'selector' => '*' |
||
| 92 | ], |
||
| 93 | [ |
||
| 94 | 'title' => 'Heading 2', |
||
| 95 | 'classes' => 'h2', |
||
| 96 | 'selector' => '*' |
||
| 97 | ], |
||
| 98 | [ |
||
| 99 | 'title' => 'Heading 3', |
||
| 100 | 'classes' => 'h3', |
||
| 101 | 'selector' => '*' |
||
| 102 | ], |
||
| 103 | [ |
||
| 104 | 'title' => 'Heading 4', |
||
| 105 | 'classes' => 'h4', |
||
| 106 | 'selector' => '*' |
||
| 107 | ], |
||
| 108 | [ |
||
| 109 | 'title' => 'Heading 5', |
||
| 110 | 'classes' => 'h5', |
||
| 111 | 'selector' => '*' |
||
| 112 | ], |
||
| 113 | [ |
||
| 114 | 'title' => 'Heading 6', |
||
| 115 | 'classes' => 'h6', |
||
| 116 | 'selector' => '*' |
||
| 117 | ], |
||
| 118 | ] |
||
| 119 | ], |
||
| 120 | [ |
||
| 121 | 'title' => 'Buttons', |
||
| 122 | 'icon' => '', |
||
| 123 | 'items' => [ |
||
| 124 | [ |
||
| 125 | 'title' => 'Button', |
||
| 126 | 'classes' => 'button', |
||
| 127 | 'selector' => 'a,button' |
||
| 128 | ], |
||
| 129 | [ |
||
| 130 | 'title' => 'Button Ghost', |
||
| 131 | 'classes' => 'button--ghost', |
||
| 132 | 'selector' => '.button' |
||
| 133 | ], |
||
| 134 | [ |
||
| 135 | 'title' => 'Button Small', |
||
| 136 | 'classes' => 'button--small', |
||
| 137 | 'selector' => '.button' |
||
| 138 | ], |
||
| 139 | [ |
||
| 140 | 'title' => 'Button Link', |
||
| 141 | 'classes' => 'button--link', |
||
| 142 | 'selector' => '.button' |
||
| 143 | ] |
||
| 144 | ] |
||
| 145 | ], |
||
| 146 | [ |
||
| 147 | 'title' => 'Icon Lists', |
||
| 148 | 'icon' => '', |
||
| 149 | 'items' => [ |
||
| 150 | [ |
||
| 151 | 'title' => 'Check Circle', |
||
| 152 | 'classes' => 'iconList iconList--checkCircle', |
||
| 153 | 'selector' => 'ul,ol' |
||
| 154 | ] |
||
| 155 | ] |
||
| 156 | ] |
||
| 157 | ], |
||
| 158 | 'toolbars' => [ |
||
| 159 | 'default' => [ |
||
| 160 | [ |
||
| 161 | 'formatselect', |
||
| 162 | 'styleselect', |
||
| 163 | 'bold', |
||
| 164 | 'italic', |
||
| 165 | 'strikethrough', |
||
| 166 | 'blockquote', |
||
| 167 | '|', |
||
| 168 | 'bullist', |
||
| 169 | 'numlist', |
||
| 170 | '|', |
||
| 171 | 'link', |
||
| 172 | 'unlink', |
||
| 173 | '|', |
||
| 174 | 'pastetext', |
||
| 175 | 'removeformat', |
||
| 176 | '|', |
||
| 177 | 'undo', |
||
| 178 | 'redo', |
||
| 179 | 'fullscreen' |
||
| 180 | ] |
||
| 181 | ], |
||
| 182 | 'basic' => [ |
||
| 183 | [ |
||
| 184 | 'bold', |
||
| 185 | 'italic', |
||
| 186 | 'strikethrough', |
||
| 187 | '|', |
||
| 188 | 'link', |
||
| 189 | 'unlink', |
||
| 190 | '|', |
||
| 191 | 'undo', |
||
| 192 | 'redo', |
||
| 193 | 'fullscreen' |
||
| 194 | ] |
||
| 199 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.