| Conditions | 5 | 
| Paths | 6 | 
| Total Lines | 53 | 
| Code Lines | 23 | 
| 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 | public function action_editorSettings_display()  | 
            ||
| 72 | 	{ | 
            ||
| 73 | global $context, $txt, $modSettings;  | 
            ||
| 74 | |||
| 75 | // Initialize the form  | 
            ||
| 76 | $settingsForm = new SettingsForm(SettingsForm::DB_ADAPTER);  | 
            ||
| 77 | |||
| 78 | // Initialize it with our settings  | 
            ||
| 79 | $settingsForm->setConfigVars($this->_settings());  | 
            ||
| 80 | |||
| 81 | // Make sure a nifty javascript will enable/disable checkboxes, according to BBC globally set or not.  | 
            ||
| 82 | 		theme()->addInlineJavascript(' | 
            ||
| 83 | toggleBBCDisabled(\'disabledBBC\', ' . (empty($modSettings['enableBBC']) ? 'true' : 'false') . ');', true);  | 
            ||
| 84 | |||
| 85 | // Make sure we check the right tags!  | 
            ||
| 86 | 		$modSettings['bbc_disabled_disabledBBC'] = empty($modSettings['disabledBBC']) ? array() : explode(',', $modSettings['disabledBBC']); | 
            ||
| 87 | |||
| 88 | // Save page  | 
            ||
| 89 | if (isset($this->_req->query->save))  | 
            ||
| 90 | 		{ | 
            ||
| 91 | checkSession();  | 
            ||
| 92 | |||
| 93 | // Security: make a pass through all tags and fix them as necessary  | 
            ||
| 94 | $codes = ParserWrapper::instance()->getCodes();  | 
            ||
| 95 | $bbcTags = $codes->getTags();  | 
            ||
| 96 | |||
| 97 | 			$disabledBBC_enabledTags = $this->_req->getPost('disabledBBC_enabledTags', null, []); | 
            ||
| 98 | if (!is_array($disabledBBC_enabledTags))  | 
            ||
| 99 | 			{ | 
            ||
| 100 | $disabledBBC_enabledTags = array($disabledBBC_enabledTags);  | 
            ||
| 101 | }  | 
            ||
| 102 | |||
| 103 | // Work out what is actually disabled!  | 
            ||
| 104 | 			$this->_req->post->disabledBBC = implode(',', array_diff($bbcTags, $disabledBBC_enabledTags)); | 
            ||
| 105 | |||
| 106 | // Notify addons and integrations  | 
            ||
| 107 | 			call_integration_hook('integrate_save_bbc_settings', array($bbcTags)); | 
            ||
| 108 | |||
| 109 | // Save the result  | 
            ||
| 110 | $settingsForm->setConfigValues((array) $this->_req->post);  | 
            ||
| 111 | $settingsForm->save();  | 
            ||
| 112 | |||
| 113 | // And we're out of here!  | 
            ||
| 114 | 			redirectexit('action=admin;area=editor'); | 
            ||
| 115 | }  | 
            ||
| 116 | |||
| 117 | // Make sure the template stuff is ready now...  | 
            ||
| 118 | $context['sub_template'] = 'show_settings';  | 
            ||
| 119 | $context['page_title'] = $txt['manageposts_editor_settings_title'];  | 
            ||
| 120 | 		$context['post_url'] = getUrl('admin', ['action' => 'admin', 'area' => 'editor;save']); | 
            ||
| 121 | $context['settings_title'] = $txt['manageposts_editor_settings_title'];  | 
            ||
| 122 | |||
| 123 | $settingsForm->prepare();  | 
            ||
| 124 | }  | 
            ||
| 161 |