| Conditions | 10 |
| Paths | 48 |
| Total Lines | 56 |
| Code Lines | 30 |
| 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 |
||
| 15 | public function dispSyndicationAdminConfig() |
||
| 16 | { |
||
| 17 | $oModuleModel = getModel('module'); |
||
| 18 | |||
| 19 | $module_config = $oModuleModel->getModuleConfig('syndication'); |
||
| 20 | |||
| 21 | $oSyndicationModel = getModel('syndication'); |
||
| 22 | Context::set('ping_log', $oSyndicationModel->getResentPingLog()); |
||
| 23 | |||
| 24 | if(!$module_config->syndication_use) |
||
| 25 | { |
||
| 26 | $module_config->syndication_use = 'Y'; |
||
| 27 | } |
||
| 28 | |||
| 29 | if(!$module_config->site_url) |
||
| 30 | { |
||
| 31 | $module_config->site_url = Context::getDefaultUrl()?Context::getDefaultUrl():getFullUrl(); |
||
| 32 | } |
||
| 33 | |||
| 34 | if(!$module_config->year) |
||
| 35 | { |
||
| 36 | $module_config->year = date("Y"); |
||
| 37 | } |
||
| 38 | |||
| 39 | if(!isset($module_config->syndication_password)) |
||
| 40 | { |
||
| 41 | $module_config->syndication_password = uniqid(); |
||
| 42 | } |
||
| 43 | |||
| 44 | Context::set('syndication_use', $module_config->syndication_use); |
||
| 45 | Context::set('site_url', preg_replace('/^(http|https):\/\//i','',$module_config->site_url)); |
||
| 46 | Context::set('year', $module_config->year); |
||
| 47 | Context::set('syndication_token', $module_config->syndication_token); |
||
| 48 | Context::set('syndication_password', $module_config->syndication_password); |
||
| 49 | Context::set('uri_scheme', (Context::getSslStatus() == 'always') ? 'https://' : 'http://'); |
||
| 50 | |||
| 51 | $output = executeQueryArray('syndication.getExceptModules'); |
||
| 52 | $except_module_list = array(); |
||
| 53 | if($output->data && count($output->data) > 0) |
||
| 54 | { |
||
| 55 | foreach($output->data as $item) |
||
| 56 | { |
||
| 57 | $except_module_list[] = $item; |
||
| 58 | } |
||
| 59 | } |
||
| 60 | Context::set('except_module', $except_module_list); |
||
| 61 | |||
| 62 | |||
| 63 | //Security |
||
| 64 | $security = new Security(); |
||
| 65 | $security->encodeHTML('services..service','except_module..ping'); |
||
| 66 | $security->encodeHTML('except_module..mid','except_module..browser_title'); |
||
| 67 | |||
| 68 | $this->setTemplatePath($this->module_path.'tpl'); |
||
| 69 | $this->setTemplateFile('config'); |
||
| 70 | } |
||
| 71 | |||
| 73 |