| Conditions | 4 |
| Paths | 8 |
| Total Lines | 109 |
| Code Lines | 54 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 7 | ||
| Bugs | 0 | Features | 4 |
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 |
||
| 49 | public static function showPage (Registry &$registry, Page &$page, PageType &$page_type) { |
||
| 50 | //create new template |
||
| 51 | $template = new DwooTemplate("index"); |
||
| 52 | |||
| 53 | $title_preafix = Settings::get("title_praefix", ""); |
||
| 54 | $title_suffix = Settings::get("title_suffix", ""); |
||
| 55 | |||
| 56 | //translate title |
||
| 57 | $title = Translator::translateTitle($page->getTitle()); |
||
| 58 | |||
| 59 | //assign variables |
||
| 60 | $template->assign("TITLE", $title_preafix . $title . $title_suffix); |
||
| 61 | $template->assign("SHORT_TITLE", $title); |
||
| 62 | $template->assign("RAW_TITLE", $page->getTitle()); |
||
| 63 | $template->assign("REGISTRY", $registry->listSettings()); |
||
| 64 | |||
| 65 | $head_content = ""; |
||
| 66 | |||
| 67 | Events::throwEvent("get_head", array( |
||
| 68 | 'registry' => &$registry, |
||
| 69 | 'page' => &$page, |
||
| 70 | 'page_type' => &$page_type, |
||
| 71 | 'head_content' => $head_content |
||
| 72 | )); |
||
| 73 | |||
| 74 | $template->assign("HEAD", $head_content . $page_type->getAdditionalHeaderCode()); |
||
| 75 | |||
| 76 | $template->assign("CONTENT", $page_type->getContent()); |
||
| 77 | $template->assign("HEADER", $registry->getSetting("header", "")); |
||
| 78 | $template->assign("FOOTER", $registry->getSetting("footer", "")); |
||
| 79 | $template->assign("COPYRIGHT", Settings::get("copyright", "<strong>Copyright © 2018 <a href=\"http://jukusoft.com\">JuKuSoft.com</a></strong>, All Rights Reserved.")); |
||
| 80 | |||
| 81 | $template->assign("FOOTER_SCRIPTS", $page_type->getFooterScripts()); |
||
| 82 | |||
| 83 | $template->assign("MY_GROUP_IDS", implode(",", $registry->getObject("groups")->listGroupIDs())); |
||
| 84 | $template->assign("CHARSET", $page_type->getCharset()); |
||
| 85 | |||
| 86 | //create new css builder |
||
| 87 | /*$css_builder = new CSSBuilder(); |
||
| 88 | |||
| 89 | //create new js builder |
||
| 90 | $js_builder = new JSBuilder(); |
||
| 91 | |||
| 92 | $current_style = $registry->getSetting("current_style_name"); |
||
| 93 | $template->assign("CSS_HASH_ALL", $css_builder->getHash($current_style, "ALL", "header")); |
||
| 94 | $template->assign("JS_HASH_ALL_HEADER", $js_builder->getHash($current_style, "ALL", "header")); |
||
| 95 | $template->assign("JS_HASH_ALL_FOOTER", $js_builder->getHash($current_style, "ALL", "footer")); |
||
| 96 | |||
| 97 | //set empty flags |
||
| 98 | $template->assign("CSS_ALL_EMPTY", $css_builder->isEmpty($current_style, "ALL", "header")); |
||
| 99 | $template->assign("JS_ALL_HEADER_EMPTY", $js_builder->isEmpty($current_style, "ALL", "header")); |
||
| 100 | $template->assign("JS_ALL_FOOTER_EMPTY", $js_builder->isEmpty($current_style, "ALL", "footer"));*/ |
||
| 101 | |||
| 102 | //set sidebar arrays |
||
| 103 | $left_sidebar = Registry::singleton()->getObject("left_sidebar"); |
||
| 104 | $right_sidebar = Registry::singleton()->getObject("right_sidebar"); |
||
| 105 | $sidebars_var = array( |
||
| 106 | 'left_sidebar' => $left_sidebar->listWidgetTplArray(), |
||
| 107 | 'right_sidebar' => $right_sidebar->listWidgetTplArray() |
||
| 108 | ); |
||
| 109 | $template->assign("sidebars", $sidebars_var); |
||
| 110 | |||
| 111 | //set version and build number |
||
| 112 | if (PermissionChecker::current()->hasRight("can_see_cms_version")) { |
||
| 113 | $template->assign("VERSION", Version::current()->getVersion()); |
||
| 114 | $template->assign("BUILD", Version::current()->getBuildNumber()); |
||
| 115 | } else { |
||
| 116 | $template->assign("VERSION", "Unknown"); |
||
| 117 | $template->assign("BUILD", "Unknown"); |
||
| 118 | } |
||
| 119 | |||
| 120 | //userid and username |
||
| 121 | $user = User::current(); |
||
| 122 | /*$template->assign("USERID", $user->getID()); |
||
| 123 | $template->assign("USERNAME", $user->getUsername());*/ |
||
| 124 | $template->assign("IS_LOGGED_IN", $user->isLoggedIn()); |
||
| 125 | |||
| 126 | //assign menu code |
||
| 127 | $globalMenu = $registry->getObject("main_menu"); |
||
| 128 | $localMenu = $registry->getObject("local_menu"); |
||
| 129 | $template->assign("MENU", $globalMenu->getCode()); |
||
| 130 | $template->assign("LOCALMENU", $localMenu->getCode()); |
||
| 131 | |||
| 132 | if (User::current()->isLoggedIn()) { |
||
| 133 | $template->assign("is_logged_in", true); |
||
| 134 | //$template->parse("main.logged_in"); |
||
| 135 | } else { |
||
| 136 | $template->assign("is_logged_in", false); |
||
| 137 | //$template->parse("main.not_logged_in"); |
||
| 138 | } |
||
| 139 | |||
| 140 | //throw event |
||
| 141 | Events::throwEvent("show_page", array( |
||
| 142 | 'registry' => &$registry, |
||
| 143 | 'page' => &$page, |
||
| 144 | 'page_type' => &$page_type, |
||
| 145 | 'template' => &$template |
||
| 146 | )); |
||
| 147 | |||
| 148 | if ($page_type->showFooter()) { |
||
| 149 | $template->assign("show_footer", true); |
||
| 150 | //$template->parse("main.footer"); |
||
| 151 | } else { |
||
| 152 | $template->assign("show_footer", false); |
||
| 153 | } |
||
| 154 | |||
| 155 | //$template->parse(); |
||
| 156 | |||
| 157 | echo $template->getCode(); |
||
| 158 | } |
||
| 163 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths