| Conditions | 6 |
| Paths | 4 |
| Total Lines | 189 |
| Code Lines | 80 |
| 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 |
||
| 64 | protected function prepareConfig() |
||
| 65 | { |
||
| 66 | $userOptions = $this->pluginOptions; |
||
| 67 | $localOptions = []; |
||
|
|
|||
| 68 | switch ($this->preset) { |
||
| 69 | |||
| 70 | case 'minimal': |
||
| 71 | $localOptions = [ |
||
| 72 | 'height' => 100, |
||
| 73 | 'toolbarGroups' => [ |
||
| 74 | ['name' => 'undo'], |
||
| 75 | ['name' => 'basicstyles', |
||
| 76 | 'groups' => ['basicstyles', 'cleanup'], //wlchere would like to add specialchar |
||
| 77 | ], |
||
| 78 | ['name' => 'clipboard'], |
||
| 79 | ], |
||
| 80 | 'removeButtons' => 'Subscript,Superscript', |
||
| 81 | /*'removePlugins' => 'elementspath',*/ |
||
| 82 | 'resize_enabled' => false, // wlchere - not working |
||
| 83 | ]; |
||
| 84 | break; |
||
| 85 | |||
| 86 | case 'basic': |
||
| 87 | $localOptions = [ |
||
| 88 | 'height' => 150, |
||
| 89 | 'toolbarGroups' => [ |
||
| 90 | ['name' => 'undo'], |
||
| 91 | ['name' => 'basicstyles', |
||
| 92 | 'groups' => ['basicstyles', 'cleanup'] |
||
| 93 | ], |
||
| 94 | ['name' => 'colors'], |
||
| 95 | ['name' => 'links', |
||
| 96 | 'groups' => ['links', 'insert'] |
||
| 97 | ], |
||
| 98 | ['name' => 'others', |
||
| 99 | 'groups' => ['others', 'about'] |
||
| 100 | ], |
||
| 101 | ], |
||
| 102 | 'removeButtons' => 'Subscript,Superscript,Flash,Table,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe,Youtube', |
||
| 103 | /*'removePlugins' => 'elementspath',*/ |
||
| 104 | 'resize_enabled' => false, |
||
| 105 | 'removeDialogTabs' => 'link:advanced', |
||
| 106 | ]; |
||
| 107 | break; |
||
| 108 | |||
| 109 | case 'standard': |
||
| 110 | default: |
||
| 111 | $localOptions = [ |
||
| 112 | 'height' => 200, |
||
| 113 | 'toolbarGroups' => [ |
||
| 114 | ['name' => 'clipboard', |
||
| 115 | 'groups' => ['mode', 'undo', 'selection', 'clipboard', 'doctools'] |
||
| 116 | ], |
||
| 117 | ['name' => 'editing', |
||
| 118 | 'groups' => ['tools', 'about'] |
||
| 119 | ], |
||
| 120 | '/', |
||
| 121 | ['name' => 'paragraph', |
||
| 122 | 'groups' => ['templates', 'list', 'indent', 'align'] |
||
| 123 | ], |
||
| 124 | ['name' => 'insert'], |
||
| 125 | '/', |
||
| 126 | ['name' => 'basicstyles', |
||
| 127 | 'groups' => ['basicstyles', 'cleanup'] |
||
| 128 | ], |
||
| 129 | ['name' => 'colors'], |
||
| 130 | ['name' => 'links'], |
||
| 131 | ['name' => 'others'], |
||
| 132 | ], |
||
| 133 | 'removeButtons' => 'Smiley,Iframe' |
||
| 134 | ]; |
||
| 135 | break; |
||
| 136 | |||
| 137 | case 'full': |
||
| 138 | $localOptions = [ |
||
| 139 | 'height' => 300, |
||
| 140 | 'toolbarGroups' => [ |
||
| 141 | ['name' => 'document', |
||
| 142 | 'groups' => ['mode', 'document', 'doctools'] |
||
| 143 | ], |
||
| 144 | ['name' => 'clipboard', |
||
| 145 | 'groups' => ['clipboard', 'undo'] |
||
| 146 | ], |
||
| 147 | ['name' => 'editing', |
||
| 148 | 'groups' => ['find', 'selection', 'spellchecker'] |
||
| 149 | ], |
||
| 150 | ['name' => 'forms'], |
||
| 151 | '/', |
||
| 152 | ['name' => 'basicstyles', |
||
| 153 | 'groups' => ['basicstyles', 'colors','cleanup'] |
||
| 154 | ], |
||
| 155 | ['name' => 'paragraph', |
||
| 156 | 'groups' => [ 'list', 'indent', 'blocks', 'align', 'bidi' ] |
||
| 157 | ], |
||
| 158 | ['name' => 'links'], |
||
| 159 | ['name' => 'insert'], |
||
| 160 | '/', |
||
| 161 | ['name' => 'styles'], |
||
| 162 | ['name' => 'blocks'], |
||
| 163 | ['name' => 'colors'], |
||
| 164 | ['name' => 'tools'], |
||
| 165 | ['name' => 'others'], |
||
| 166 | ], |
||
| 167 | ]; |
||
| 168 | break; |
||
| 169 | |||
| 170 | case 'all': |
||
| 171 | // default ckeditor internal config |
||
| 172 | break; |
||
| 173 | } |
||
| 174 | |||
| 175 | //wlchere |
||
| 176 | // console.plugins = 'dialogui,dialog,a11yhelp,about,basicstyles,bidi,blockquote,clipboard,button,panelbutton,panel,floatpanel,colorbutton,colordialog,menu,contextmenu,dialogadvtab,div,elementspath,enterkey,entities,popup,filebrowser,find,fakeobjects,flash,floatingspace,listblock,richcombo,font,format,forms,horizontalrule,htmlwriter,iframe,image,indent,indentblock,indentlist,justify,menubutton,language,link,list,liststyle,magicline,maximize,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,resize,save,scayt,selectall,showblocks,showborders,smiley,sourcearea,specialchar,stylescombo,tab,table,tabletools,templates,toolbar,undo,wsc,wysiwygarea,autogrow,xml,ajax,lineutils,widget,codesnippet,codemirror,confighelper,maxheight,onchange,quicktable,stylesheetparser-fixed,tableresize,youtube'; |
||
| 177 | // optional maxheight plugin |
||
| 178 | /* |
||
| 179 | plugins : { |
||
| 180 | 'a11yhelp' : 1, |
||
| 181 | 'about' : 1, |
||
| 182 | 'ajax' : 1, |
||
| 183 | 'autogrow' : 1, |
||
| 184 | 'basicstyles' : 1, |
||
| 185 | 'bidi' : 1, |
||
| 186 | 'blockquote' : 1, |
||
| 187 | 'clipboard' : 1, |
||
| 188 | 'codemirror' : 1, |
||
| 189 | 'codesnippet' : 1, |
||
| 190 | 'colorbutton' : 1, |
||
| 191 | 'colordialog' : 1, |
||
| 192 | 'confighelper' : 1, |
||
| 193 | 'contextmenu' : 1, |
||
| 194 | 'dialogadvtab' : 1, |
||
| 195 | 'div' : 1, |
||
| 196 | 'elementspath' : 1, |
||
| 197 | 'enterkey' : 1, |
||
| 198 | 'entities' : 1, |
||
| 199 | 'filebrowser' : 1, |
||
| 200 | 'find' : 1, |
||
| 201 | 'flash' : 1, |
||
| 202 | 'floatingspace' : 1, |
||
| 203 | 'font' : 1, |
||
| 204 | 'format' : 1, |
||
| 205 | 'forms' : 1, |
||
| 206 | 'horizontalrule' : 1, |
||
| 207 | 'htmlwriter' : 1, |
||
| 208 | 'iframe' : 1, |
||
| 209 | 'image' : 1, |
||
| 210 | 'indentblock' : 1, |
||
| 211 | 'indentlist' : 1, |
||
| 212 | 'justify' : 1, |
||
| 213 | 'language' : 1, |
||
| 214 | 'link' : 1, |
||
| 215 | 'list' : 1, |
||
| 216 | 'liststyle' : 1, |
||
| 217 | 'magicline' : 1, |
||
| 218 | 'maxheight' : 1, |
||
| 219 | 'maximize' : 1, |
||
| 220 | 'newpage' : 1, |
||
| 221 | 'onchange' : 1, |
||
| 222 | 'pagebreak' : 1, |
||
| 223 | 'pastefromword' : 1, |
||
| 224 | 'pastetext' : 1, |
||
| 225 | 'preview' : 1, |
||
| 226 | 'print' : 1, |
||
| 227 | 'quicktable' : 1, |
||
| 228 | 'removeformat' : 1, |
||
| 229 | 'resize' : 1, |
||
| 230 | 'save' : 1, |
||
| 231 | 'scayt' : 1, |
||
| 232 | 'selectall' : 1, |
||
| 233 | 'showblocks' : 1, |
||
| 234 | 'showborders' : 1, |
||
| 235 | 'smiley' : 1, |
||
| 236 | 'sourcearea' : 1, |
||
| 237 | 'specialchar' : 1, |
||
| 238 | 'stylescombo' : 1, |
||
| 239 | 'stylesheetparser-fixed' : 1, |
||
| 240 | 'tab' : 1, |
||
| 241 | 'table' : 1, |
||
| 242 | 'tableresize' : 1, |
||
| 243 | 'tabletools' : 1, |
||
| 244 | 'templates' : 1, |
||
| 245 | 'toolbar' : 1, |
||
| 246 | 'undo' : 1, |
||
| 247 | 'wsc' : 1, |
||
| 248 | 'wysiwygarea' : 1, |
||
| 249 | 'youtube |
||
| 250 | */ |
||
| 251 | $this->pluginOptions = ArrayHelper::merge($localOptions, $userOptions); |
||
| 252 | } |
||
| 253 | |||
| 285 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.