| Conditions | 1 |
| Paths | 1 |
| Total Lines | 99 |
| 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 |
||
| 73 | function getConfig() |
||
| 74 | { |
||
| 75 | return [ |
||
| 76 | 'blockformats' => [ |
||
| 77 | 'Paragraph' => 'p', |
||
| 78 | 'Heading 1' => 'h1', |
||
| 79 | 'Heading 2' => 'h2', |
||
| 80 | 'Heading 3' => 'h3', |
||
| 81 | 'Heading 4' => 'h4', |
||
| 82 | 'Heading 5' => 'h5', |
||
| 83 | 'Heading 6' => 'h6' |
||
| 84 | ], |
||
| 85 | 'styleformats' => [ |
||
| 86 | [ |
||
| 87 | 'title' => 'Buttons', |
||
| 88 | 'icon' => '', |
||
| 89 | 'items' => [ |
||
| 90 | [ |
||
| 91 | 'title' => 'Button Primary', |
||
| 92 | 'classes' => 'btn btn--primary', |
||
| 93 | 'selector' => 'a' |
||
| 94 | ], |
||
| 95 | [ |
||
| 96 | 'title' => 'Button Primary Block', |
||
| 97 | 'classes' => 'btn btn--primary btn--block', |
||
| 98 | 'selector' => 'a' |
||
| 99 | ] |
||
| 100 | ] |
||
| 101 | ] |
||
| 102 | ], |
||
| 103 | 'toolbars' => [ |
||
| 104 | 'default' => [ |
||
| 105 | [ |
||
| 106 | 'formatselect', |
||
| 107 | 'styleselect', |
||
| 108 | 'bold', |
||
| 109 | 'italic', |
||
| 110 | 'underline', |
||
| 111 | 'strikethrough', |
||
| 112 | '|', |
||
| 113 | 'bullist', |
||
| 114 | 'numlist', |
||
| 115 | '|', |
||
| 116 | 'link', |
||
| 117 | 'unlink', |
||
| 118 | '|', |
||
| 119 | 'wp_more', |
||
| 120 | 'pastetext', |
||
| 121 | 'removeformat', |
||
| 122 | '|', |
||
| 123 | 'undo', |
||
| 124 | 'redo', |
||
| 125 | 'fullscreen' |
||
| 126 | ] |
||
| 127 | ], |
||
| 128 | 'full' => [ |
||
| 129 | [ |
||
| 130 | 'formatselect', |
||
| 131 | 'styleselect', |
||
| 132 | 'bold', |
||
| 133 | 'italic', |
||
| 134 | 'underline', |
||
| 135 | 'blockquote', |
||
| 136 | '|', |
||
| 137 | 'bullist', |
||
| 138 | 'numlist', |
||
| 139 | '|', |
||
| 140 | 'link', |
||
| 141 | 'unlink', |
||
| 142 | '|', |
||
| 143 | 'pastetext', |
||
| 144 | 'removeformat', |
||
| 145 | '|', |
||
| 146 | 'undo', |
||
| 147 | 'redo', |
||
| 148 | 'fullscreen' |
||
| 149 | ] |
||
| 150 | ], |
||
| 151 | 'basic' => [ |
||
| 152 | [ |
||
| 153 | 'bold', |
||
| 154 | 'italic', |
||
| 155 | 'underline', |
||
| 156 | 'blockquote', |
||
| 157 | 'bullist', |
||
| 158 | 'numlist', |
||
| 159 | 'alignleft', |
||
| 160 | 'aligncenter', |
||
| 161 | 'alignright', |
||
| 162 | 'undo', |
||
| 163 | 'redo', |
||
| 164 | 'link', |
||
| 165 | 'unlink', |
||
| 166 | 'fullscreen' |
||
| 167 | ] |
||
| 168 | ] |
||
| 169 | ] |
||
| 170 | ]; |
||
| 171 | } |
||
| 172 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.