| Conditions | 6 |
| Paths | 10 |
| Total Lines | 53 |
| Code Lines | 45 |
| 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 namespace XoopsModules\Tdmcreate\Files\Templates\User; |
||
| 104 | public function render() |
||
| 105 | { |
||
| 106 | $module = $this->getModule(); |
||
| 107 | $table = $this->getTable(); |
||
| 108 | $filename = $this->getFileName(); |
||
| 109 | $moduleDirname = $module->getVar('mod_dirname'); |
||
| 110 | $language = $this->getLanguage($moduleDirname, 'MA'); |
||
| 111 | $content = <<<EOT |
||
| 112 | <{if \$bookmarks != 0}> |
||
| 113 | <{include file="db:system_bookmarks.tpl"}> |
||
| 114 | <{/if}> |
||
| 115 | \n<{if \$fbcomments != 0}> |
||
| 116 | <{include file="db:system_fbcomments.tpl"}> |
||
| 117 | <{/if}> |
||
| 118 | <div class="pull-left"><{\$copyright}></div>\n |
||
| 119 | EOT; |
||
| 120 | if (is_object($table) && null != $table->getVar('table_name')) { |
||
| 121 | $content .= <<<EOT |
||
| 122 | <{if \$pagenav != ''}> |
||
| 123 | <div class="pull-right"><{\$pagenav}></div> |
||
| 124 | <{/if}> |
||
| 125 | <br>\n |
||
| 126 | EOT; |
||
| 127 | } |
||
| 128 | $content .= <<<EOT |
||
| 129 | <{if \$xoops_isadmin}> |
||
| 130 | <div class="text-center bold"><a href="<{\$admin}>"><{\$smarty.const.{$language}ADMIN}></a></div><br> |
||
| 131 | <{/if}>\n |
||
| 132 | EOT; |
||
| 133 | if (is_object($table)) { |
||
| 134 | if (1 == $table->getVar('table_comments')) { |
||
| 135 | $content .= <<<EOT |
||
| 136 | <div class="pad2 marg2"> |
||
| 137 | <{if \$comment_mode == "flat"}> |
||
| 138 | <{include file="db:system_comments_flat.tpl"}> |
||
| 139 | <{elseif \$comment_mode == "thread"}> |
||
| 140 | <{include file="db:system_comments_thread.tpl"}> |
||
| 141 | <{elseif \$comment_mode == "nest"}> |
||
| 142 | <{include file="db:system_comments_nest.tpl"}> |
||
| 143 | <{/if}> |
||
| 144 | </div>\n |
||
| 145 | <br>\n |
||
| 146 | EOT; |
||
| 147 | } |
||
| 148 | if (1 == $table->getVar('table_notifications')) { |
||
| 149 | $content .= <<<'EOT' |
||
| 150 | <{include file='db:system_notification_select.tpl'}> |
||
| 151 | EOT; |
||
| 152 | } |
||
| 153 | } |
||
| 154 | $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); |
||
| 155 | |||
| 156 | return $this->renderFile(); |
||
| 157 | } |
||
| 159 |